204 Commits

Author SHA1 Message Date
nicolaasuni
ed27e28a4c Fixed Path Traversal security vulnerability reported by Positive Technologies 2025-04-03 07:38:07 +01:00
nicolaasuni
0bc88c112e Bump version and changelog 2025-03-30 15:38:26 +01:00
nicolaasuni
bd6f7f2227 Bump version 2025-03-30 15:26:19 +01:00
nicolaasuni
45b14703c9 Bump version 2025-01-26 13:59:45 +00:00
nicolaasuni
c6bd9a93a9 Forbid access to parent folders in SVG images path. 2025-01-26 13:37:38 +00:00
nicolaasuni
a0a02efe48 Add some addTTFfont fixes from tc-lib-pdf-font 2024-12-23 12:43:22 +00:00
nicolaasuni
aab43ab0a8 Add K_CURLOPTS config array to set custom cURL options (NOTE: some defaults have changed) 2024-12-23 12:32:44 +00:00
nicolaasuni
5c046cc18c Bump version 2024-12-23 12:10:18 +00:00
nicolaasuni
7956f5e378 Update version and changelog 2024-12-13 19:31:40 +00:00
François-Xavier de Guillebon
ab7f779e33
use late state binding now that minimum PHP version is 5.5 2024-11-18 09:35:33 +01:00
nicolaasuni
696d233385 Bump version 2024-10-26 13:08:33 +01:00
Nicola Asuni
01c96e89ef
Merge multiple PRs (#756)
* Ayesh: [PHP 8.4] Fix: Curl CURLOPT_BINARYTRANSFER deprecated #675

* THenkeDE: SVG detection fix for inline data images #646

* bruno-farias:  Fix count svg #647
2024-10-26 12:13:18 +01:00
Nicola Asuni
dad9e915a0
Multiple PRs (#755)
* Update tcpdf.php

Since the version 6.7.4, the "0" is considered like empty string and not displayed

* Update tcpdf.php

Co-authored-by: William Desportes <williamdes@wdes.fr>

* Fixed handling of transparency in PDF/A mode in addExtGState method

The condition allowed to add ExtGState in all PDF/A modes and disallowed
in default mode.

This fix inlines the condition with setExtGState to allow transparency
parameters for non-PDF/A and PDF/A > 1 documents.

The state condition is copied from 'setExtGState'.

* Encrypt /DA string when document is encrypted

When document is encrypted then /DA string must be encrypted,
without this Acrobat cannot allow fill form fields.

* Improve quality of generated seed, avoid potential security pitfall

* Try to use random_bytes() first if it's available
* Do not include the server parameters in the generated seed, as
they might contain sensitive data

As all current usages of getRandomSeed() directly hash the seed,
there should be no BC breaking changes.

The main source of entropy is more than enough on its own if
random_bytes() or openssl_random_pseudo_bytes() are available.

* Fix bug on _getannotsrefs when there are empty signature appearances but not other annot on a page

* Fix SVG coordinate parser that caused drawing artifacts

* Remove usage of xml_set_object() function

The xml_set_object() function will be deprecated in PHP 8.4 as well as
passing non-callable strings to the xml_set_*_handler() functions.

Instead of using xml_set_object(), the string method names in
xml_set_element_handler() and xml_set_character_data_handler() should be
replaced with callables.

- https://wiki.php.net/rfc/deprecations_php_8_4#xml_set_object_and_xml_set_handler_with_string_method_names

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>

---------

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
Co-authored-by: jlouche <61839660+jlouche@users.noreply.github.com>
Co-authored-by: William Desportes <williamdes@wdes.fr>
Co-authored-by: stollr <christian.stoller@mail.de>
Co-authored-by: Robert Jędrzejczyk <robert@prog.olsztyn.pl>
Co-authored-by: Andreas Erhard <andreas.erhard@i-med.ac.at>
Co-authored-by: Alejandro Precioso <aprecioso@bigtree.com.ar>
Co-authored-by: davidrod <david@gassiotllobet.com>
Co-authored-by: sslldavid <119080321+sslldavid@users.noreply.github.com>
Co-authored-by: Alejandro <aprecioso@gmail.com>
Co-authored-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2024-10-26 10:29:48 +01:00
nicolaasuni
bfa7d2b6d4 Forbid access to parent folder in HTML images 2024-10-06 11:38:38 +01:00
nicolaasuni
951eabf033 Bump version 2024-04-20 18:25:10 +01:00
Josh
05f3a28f4a
fix: CSV-2024-22640 (#712)
Add possessive quantifiers to the regex to prevent catastrophic backtracking.
2024-04-20 18:03:05 +01:00
nicolaasuni
82fc97bf1c Squash multiple fixes 2024-03-25 23:52:22 +00:00
nicolaasuni
e3cffc9bcb Bump version 2022-12-17 10:28:59 +00:00
nicolaasuni
b133c47e93 Fix syntax error 2022-12-17 10:26:06 +00:00
nicolaasuni
e3d45a6853 Ensure return type is always array 2022-12-17 10:19:28 +00:00
Bart Driessen
ef356f0bc7
Avoid a deprecated error from PHP8.1 (#573)
Co-authored-by: Nicola Asuni <nicolaasuni@users.noreply.github.com>
Co-authored-by: William Desportes <williamdes@wdes.fr>
2022-12-17 09:59:09 +00:00
Michael Voříšek
37aa6eeb73
Add PHPStan and fix level 1 errors (#307)
* Add PHPStan level 1

Co-authored-by: Nicola Asuni <nicolaasuni@users.noreply.github.com>
2022-12-12 14:38:07 +00:00
nicolaasuni
154bba45ff Bump version 2022-12-06 09:28:13 +00:00
Bayram Arslan
ca70b94577
FIX: PDF417 corrupt output problem, solution set bcmath scale parameter to zero (#534)
Co-authored-by: Nicola Asuni <nicolaasuni@users.noreply.github.com>
2022-12-06 08:55:12 +00:00
Julien Maumené
f794192a90
fix: php 8.1 notices (#548)
PHP Deprecated:  Implicit conversion from float 31.5 to int loses precision in /var/www/html/vendor/tecnickcom/tcpdf/include/barcodes/qrcode.php on line 891
PHP Deprecated:  Implicit conversion from float 3.5 to int loses precision in /var/www/html/vendor/tecnickcom/tcpdf/include/barcodes/qrcode.php on line 895

Co-authored-by: Nicola Asuni <nicolaasuni@users.noreply.github.com>
2022-12-06 08:13:09 +00:00
nicolaasuni
cc54c15036 Bump version 2022-08-12 08:50:54 +01:00
Richard
5a04f6e0e8
encodeUrlQuery takes into account the port (#493)
In order to take into account the port in the URLs (related to PR #148).

Co-authored-by: Nicola Asuni <nicolaasuni@users.noreply.github.com>
2022-08-12 08:44:18 +01:00
Joost de Bruijn
1ecad8827a
fix: php 8.1 notices (#481)
* fix: php 8.1 notices

* fix: php5 compatible code

Co-authored-by: Nicola Asuni <nicolaasuni@users.noreply.github.com>
2022-08-12 08:30:12 +01:00
nicolaasuni
42cd0f9786 Bump version 2021-12-31 08:39:24 +00:00
William Desportes
960e7d563d
PHP 8.1 fixes and PHP 5.x CI fix (#463)
* Fix call signatures on example 12 for PHP 8.1 strpos null errors

* Fix #401 - PHP 8.1 casts to int - getGDgamma - CoonsPatchMesh

Fixes: tecnickcom/TCPDF#401

* PHP 8.1 - cast in _RC4 before sending to str_repeat

* Enable back extensions on PHP 5.{3,4,5}

* Improve the test script to allow testing other PHP versions locally

* Fix typo on "parametrs" -> "parameters"

* Reduce possible side effects with the OS

* Fix #461 - fix barcodes handling using false, PHP 8.1 deprecation

Fixes: tecnickcom/TCPDF#461

* Fix #401 - PHP 8.1 casts to int - CoonsPatchMesh

Fixes: tecnickcom/TCPDF#401

Co-authored-by: Nicola Asuni <nicolaasuni@users.noreply.github.com>
2021-12-31 08:34:37 +00:00
nicolaasuni
3cfc830d70 Bump version 2021-12-28 12:31:24 +00:00
Simon Stücher
8a1907437d
Fix type hint for \TCPDF_STATIC::_freadint (#414)
Co-authored-by: Nicola Asuni <nicolaasuni@users.noreply.github.com>
2021-12-28 12:09:50 +00:00
Vincent Langlet
df4a8e6f96
Fix phpdoc and prefer null as default value (#444)
* Fix phpdoc and prefer null as default value

Co-authored-by: Michael Voříšek <mvorisek@mvorisek.cz>
Co-authored-by: Nicola Asuni <nicolaasuni@users.noreply.github.com>
2021-12-28 12:00:30 +00:00
SuperVirus
cd683e3d83
Fix AES128 encryption if the OpenSSL extension is installed (#453)
* Fix AES128 encryption if the OpenSSL extension is installed

* Simplified code

Co-authored-by: Nicola Asuni <nicolaasuni@users.noreply.github.com>
2021-12-28 11:56:41 +00:00
nicolaasuni
172540dcbf Bump version 2021-07-20 15:43:20 +01:00
Simon Stücher
bf02c1cb62
Fix type hints (#399)
* Fix type hints

* More accurate type hint

Co-authored-by: William Desportes <williamdes@wdes.fr>

* document void return

* document void return

* Update include/tcpdf_fonts.php

Co-authored-by: William Desportes <williamdes@wdes.fr>

* Fix type hints

Co-authored-by: William Desportes <williamdes@wdes.fr>
Co-authored-by: Nicola Asuni <nicolaasuni@users.noreply.github.com>
2021-07-20 15:25:22 +01:00
Paul Holden
7f650ee925
Increase internal version number to 6.4.1. (#366)
Fixes #357.

Co-authored-by: Nicola Asuni <nicolaasuni@users.noreply.github.com>
2021-07-10 08:05:58 +01:00
William Desportes
c979d00f60
PHP error fixes and final phpdoc fixes (#348)
* Fix a PHP array offset error

* Fix PHP 8.1 type error with TCPDF_STATIC::pregSplit on preg_split

* More phpdoc blocks fixes

* Add CHANGELOG entries

* Update file descriptions for barcode examples

Co-authored-by: Nicola Asuni <nicolaasuni@users.noreply.github.com>
2021-04-02 12:45:14 +01:00
William Desportes
206a131d72
Drop a PHP 4 polyfill and add a .gitattributes file (#346)
* Drop PHP 4 polyfill for str_split

* Add a .gitattributes file

Co-authored-by: Nicola Asuni <nicolaasuni@users.noreply.github.com>
2021-03-28 11:59:03 +01:00
William Desportes
4f1d629d24
Fix all phpdoc blocks (#345)
* Add a @since on a function

* Refresh phpdoc blocks

Using `@param (\$[a-zA-Z0-9_]+)\s\(([a-z]+)\)`

* Fix phpdoc blocks

* Fix typos and phpdoc mistakes

* More phpdoc block fixes

Co-authored-by: Nicola Asuni <nicolaasuni@users.noreply.github.com>
2021-03-28 11:55:50 +01:00
Roy Van Ginneken
869ab2651b
Fix image file type for urls with query params (#287)
Co-authored-by: Nicola Asuni <nicolaasuni@users.noreply.github.com>
2021-03-27 09:17:09 +00:00
Florian Mortgat
e17b28015d
Fix vulnerability to roman numeral bombs (#315)
Co-authored-by: Nicola Asuni <nicolaasuni@users.noreply.github.com>
2021-03-27 08:47:48 +00:00
Nicola Asuni
76864e25f5
Merge branch 'main' into curl-hardening 2021-03-27 08:36:10 +00:00
Marc van Tilburg
e5c11046f8 PHP 8 (deprecation) fixes 2021-03-03 10:13:36 +01:00
Ayesh Karunaratne
65cc96b190
Curl Security: Limit protocols and redirects
In `include/tcpdf_static.php` file, there are couple Curl calls that could use some additional Curl hardening.

1. Limit the maximum number of redirects Curl is allowed to follow. Currently, it is configured in PHP source code to 20. However, as a [security precaution, limit it to 5](https://php.watch/articles/php-curl-security-hardening#infinite-redirects).

2. Curl is used here for HTTP, HTTPS, and in one instance, for FTP URLs. With `CURLOPT_FOLLOWLOCATION` option enabled, this allows a malicious remote server to perform SSRF attacks and utilize all protocols Curl supports, such as LDAP, FTP, etc that are highly undesired. Setting a restricted [`CURLOPT_PROTOCOLS` value mitigates this vulnerability](https://php.watch/articles/php-curl-security-hardening#ssrf). In older Curl versions, it even allows local file inclusion attacks with `file:///etc/passwd` style redirect URLs.
2021-01-23 14:57:33 +07:00
Cédric Anne
9616e9e44b
Fix optionnal "$tagvspaces" parameter declaration 2020-10-14 10:35:46 +02:00
Cédric Anne
292fc741f8
Fix optionnal "$k" parameter declaration 2020-10-14 10:35:08 +02:00
Cédric Anne
e5f4da5a76
Fix optionnal "$currentfont" parameter declaration 2020-10-14 10:33:59 +02:00
SuperVirus
6617ab2cd9
Changed [] to array() to maintain PHP 5.3 compat. 2020-03-08 23:19:12 +01:00
nicolaasuni
19a535eaa7 Bump version 2020-02-14 14:20:12 +00:00