summaryrefslogtreecommitdiff
path: root/ext/zip
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'PHP-7.0' into PHP-7.1Stanislav Malyshev2016-11-031-3/+3
|\ | | | | | | | | | | | | * PHP-7.0: Add length check for bzcompress too - fix for bug #73356 More string length checks & fixes More string length checks & fixes
| * Merge branch 'PHP-5.6' into PHP-7.0Stanislav Malyshev2016-11-031-3/+3
| |\ | | | | | | | | | | | | * PHP-5.6: More string length checks & fixes
| | * More string length checks & fixesStanislav Malyshev2016-11-031-3/+3
| | |
* | | Merge branch 'PHP-7.0' into PHP-7.1Remi Collet2016-10-141-1/+1
|\ \ \ | |/ / | | | | | | | | | * PHP-7.0: bump ext/zip version
| * | bump ext/zip versionRemi Collet2016-10-141-1/+1
| | |
* | | Merge branch 'PHP-7.0' into PHP-7.1Christoph M. Becker2016-09-063-6/+37
|\ \ \ | |/ /
| * | Merge branch 'PHP-5.6' into PHP-7.0Christoph M. Becker2016-09-063-6/+37
| |\ \ | | |/
| | * Fix #70752: Depacking with wrong password leaves 0 length filesChristoph M. Becker2016-09-063-7/+38
| | | | | | | | | | | | | | | We should not open the output stream before we have tried to open the archive entry, as failing the latter could leave an empty file behind.
* | | Merge branch 'PHP-7.0' into PHP-7.1Christoph M. Becker2016-08-171-0/+3
|\ \ \ | |/ /
| * | Merge branch 'PHP-5.6' into PHP-7.0Christoph M. Becker2016-08-171-0/+3
| |\ \ | | |/
| | * Fix #68302: impossible to compile php with zip supportChristoph M. Becker2016-08-171-0/+3
| | | | | | | | | | | | | | | | | | We should not let configure succeed, if SIZEOF_OFF_T == 0, just to let the compilation fail later. Instead we bail out early, giving a hint regarding the potential issue, namely misconfigured libraries.
* | | Merge branch 'PHP-7.0' into PHP-7.1Xinchen Hui2016-07-242-2/+22
|\ \ \ | |/ / | | | | | | | | | * PHP-7.0: Fixed bug #72660 (NULL Pointer dereference in zend_virtual_cwd)
| * | Fixed bug #72660 (NULL Pointer dereference in zend_virtual_cwd)Xinchen Hui2016-07-242-2/+22
| | |
| * | bump zip extension versionRemi Collet2016-07-211-1/+1
| | |
* | | Merge branch 'PHP-7.0' into PHP-7.1Remi Collet2016-07-211-1/+1
|\ \ \ | | | | | | | | | | | | | | | | * PHP-7.0: bump zip extension version
| * | | bump zip extension versionRemi Collet2016-07-211-1/+1
| |/ /
* | | Merge branch 'PHP-7.0'Stanislav Malyshev2016-07-191-2/+2
|\ \ \ | |/ / | | | | | | | | | | | | * PHP-7.0: Improve fix for #72520 #72482, revert for 5.6 for now
| * | Merge branch 'PHP-5.6' into PHP-7.0Stanislav Malyshev2016-07-191-2/+2
| |\ \ | | |/ | | | | | | | | | | | | | | | | | | | | | * PHP-5.6: Improve fix for #72520 #72482, revert for 5.6 for now Conflicts: ext/zip/zip_stream.c
| | * Merge branch 'PHP-5.5' into PHP-5.6Stanislav Malyshev2016-07-191-2/+2
| | |\ | | | | | | | | | | | | | | | | * PHP-5.5: Improve fix for #72520
| | | * Improve fix for #72520Stanislav Malyshev2016-07-191-2/+2
| | | |
* | | | Merge branch 'PHP-7.0'Stanislav Malyshev2016-07-191-2/+2
|\ \ \ \ | |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * PHP-7.0: (27 commits) fix #72519, possible OOB using imagegif fix #72512, invalid read or write for palette image when invalid transparent index is used Apparently some envs miss SIZE_MAX Fix tests Fix bug #72618: NULL Pointer Dereference in exif_process_user_comment Partial fix for bug #72613 - do not allow reading past error read Partial fix for bug #72613 - do not treat negative returns from bz2 as size_t Fix bug #72606: heap-buffer-overflow (write) simplestring_addn simplestring.c Fix for bug #72558, Integer overflow error within _gdContributionsAlloc() Fix bug #72603: Out of bound read in exif_process_IFD_in_MAKERNOTE update NEWS Fixed bug #72570 Segmentation fault when binding parameters on a query without placeholders Fix bug #72562 - destroy var_hash properly Fix bug #72551 and bug #72552 - check before converting size_t->int Fix bug #72541 - size_t overflow lead to heap corruption Fix bug #72533 (locale_accept_from_http out-of-bounds access) Fix fir bug #72520 Fix for bug #72513 Fix for bug #72513 CS fix and comments with bug ID ... Conflicts: ext/standard/basic_functions.c
| * | | Merge branch 'PHP-5.6' into PHP-7.0Stanislav Malyshev2016-07-191-2/+2
| |\ \ \ | | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * PHP-5.6: fix #72519, possible OOB using imagegif fix #72512, invalid read or write for palette image when invalid transparent index is used Apparently some envs miss SIZE_MAX Fix tests Fix bug #72618: NULL Pointer Dereference in exif_process_user_comment Partial fix for bug #72613 - do not treat negative returns from bz2 as size_t Fix bug #72606: heap-buffer-overflow (write) simplestring_addn simplestring.c Fix for bug #72558, Integer overflow error within _gdContributionsAlloc() Fix bug #72603: Out of bound read in exif_process_IFD_in_MAKERNOTE Fix bug #72562 - destroy var_hash properly Fix bug #72533 (locale_accept_from_http out-of-bounds access) Fix fir bug #72520 Fix for bug #72513 Fix for bug #72513 CS fix and comments with bug ID Fix for HTTP_PROXY issue. 5.6.24RC1 add tests for bug #72512 Fixed bug #72512 gdImageTrueColorToPaletteBody allows arbitrary write/read access Fixed bug #72479 - same as #72434 Conflicts: Zend/zend_virtual_cwd.c ext/bz2/bz2.c ext/exif/exif.c ext/session/session.c ext/snmp/snmp.c ext/standard/basic_functions.c main/SAPI.c main/php_variables.c
| | * | Merge branch 'PHP-5.5' into PHP-5.6Stanislav Malyshev2016-07-191-4/+4
| | |\ \ | | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * PHP-5.5: fix #72519, possible OOB using imagegif fix #72512, invalid read or write for palette image when invalid transparent index is used Apparently some envs miss SIZE_MAX Fix tests Fix bug #72618: NULL Pointer Dereference in exif_process_user_comment Partial fix for bug #72613 - do not treat negative returns from bz2 as size_t Fix bug #72606: heap-buffer-overflow (write) simplestring_addn simplestring.c Fix for bug #72558, Integer overflow error within _gdContributionsAlloc() Fix bug #72603: Out of bound read in exif_process_IFD_in_MAKERNOTE Fix bug #72562 - destroy var_hash properly Fix bug #72533 (locale_accept_from_http out-of-bounds access) Fix fir bug #72520 Fix for bug #72513 CS fix and comments with bug ID Fix for HTTP_PROXY issue. add tests for bug #72512 Fixed bug #72512 gdImageTrueColorToPaletteBody allows arbitrary write/read access Fixed bug #72479 - same as #72434 Conflicts: ext/bz2/bz2.c main/SAPI.c main/php_variables.c
| | | * Fix fir bug #72520Stanislav Malyshev2016-07-121-4/+4
| | | |
* | | | Merge branch 'throw-error-in-extensions'Aaron Piotrowski2016-07-051-1/+1
|\ \ \ \
| * | | | Replace zend_ce_error with NULL and replace more E_ERROR with thrown ErrorAaron Piotrowski2016-06-131-2/+1
| | | | |
| * | | | Merge branch 'master' into throw-error-in-extensionsAaron Piotrowski2016-06-1052-309/+955
| |\ \ \ \
| * | | | | Convert E_ERROR to thrown Error in extensionsAaron Piotrowski2015-07-051-1/+2
| | | | | |
* | | | | | Fixed compilation warningsDmitry Stogov2016-06-222-3/+4
| | | | | |
* | | | | | Added ZEND_ATTRIBUTE_FORMAT to some middind functions.Dmitry Stogov2016-06-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "%p" replaced by ZEND_LONG_FMT to avoid compilation warnings. Fixed most incorrect use cases of format specifiers.
* | | | | | Merge branch 'PHP-7.0'Remi Collet2016-06-211-1/+1
|\ \ \ \ \ \ | | |_|/ / / | |/| | | | | | | | | | | | | | | | * PHP-7.0: bump zip version
| * | | | | bump zip versionRemi Collet2016-06-211-1/+1
| | | | | |
* | | | | | Merge branch 'PHP-7.0'Stanislav Malyshev2016-06-211-0/+9
|\ \ \ \ \ \ | |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * PHP-7.0: iFixed bug #72446 - Integer Overflow in gdImagePaletteToTrueColor() resulting in heap overflow update NEWS fix tests fix build Fix bug #72455: Heap Overflow due to integer overflows Fix bug #72434: ZipArchive class Use After Free Vulnerability in PHP's GC algorithm and unserialize Fixed ##72433: Use After Free Vulnerability in PHP's GC algorithm and unserialize Fix bug #72407: NULL Pointer Dereference at _gdScaleVert Fix bug #72402: _php_mb_regex_ereg_replace_exec - double free Fix bug #72298 pass2_no_dither out-of-bounds access Fixed #72339 Integer Overflow in _gd2GetHeader() resulting in heap overflow Fix bug #72262 - do not overflow int Fix bug #72400 and #72403 - prevent signed int overflows for string lengths Fix bug #72275: don't allow smart_str to overflow int Fix bug #72340: Double Free Courruption in wddx_deserialize Fix bug #72321 - use efree() for emalloc allocation 5.6.23RC1 fix NEWS set versions
| * | | | | Merge branch 'PHP-5.6.23' into PHP-7.0.8Stanislav Malyshev2016-06-211-0/+9
| |\ \ \ \ \ | | | |_|/ / | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * PHP-5.6.23: (24 commits) iFixed bug #72446 - Integer Overflow in gdImagePaletteToTrueColor() resulting in heap overflow update NEWS fix tests fix build Fix bug #72455: Heap Overflow due to integer overflows Fix bug #72434: ZipArchive class Use After Free Vulnerability in PHP's GC algorithm and unserialize Fixed ##72433: Use After Free Vulnerability in PHP's GC algorithm and unserialize Fix bug #72407: NULL Pointer Dereference at _gdScaleVert Fix bug #72402: _php_mb_regex_ereg_replace_exec - double free Fix bug #72298 pass2_no_dither out-of-bounds access Fixed #72339 Integer Overflow in _gd2GetHeader() resulting in heap overflow Fix bug #72262 - do not overflow int Fix bug #72400 and #72403 - prevent signed int overflows for string lengths Fix bug #72275: don't allow smart_str to overflow int Fix bug #72340: Double Free Courruption in wddx_deserialize update NEWS Fix #66387: Stack overflow with imagefilltoborder Fix bug #72321 - use efree() for emalloc allocation 5.6.23RC1 Fix bug #72140 (segfault after calling ERR_free_strings()) ... Conflicts: configure.in ext/mbstring/php_mbregex.c ext/mcrypt/mcrypt.c ext/spl/spl_array.c ext/spl/spl_directory.c ext/standard/php_smart_str.h ext/standard/string.c ext/standard/url.c ext/wddx/wddx.c ext/zip/php_zip.c main/php_version.h
| | * | | | Merge branch 'PHP-5.5' into PHP-5.6.23Stanislav Malyshev2016-06-211-0/+9
| | |\ \ \ \ | | | | |_|/ | | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * PHP-5.5: Fixed bug #72446 - Integer Overflow in gdImagePaletteToTrueColor() resulting in heap overflow update NEWS fix tests fix build Fix bug #72455: Heap Overflow due to integer overflows Fix bug #72434: ZipArchive class Use After Free Vulnerability in PHP's GC algorithm and unserialize Fixed ##72433: Use After Free Vulnerability in PHP's GC algorithm and unserialize Fix bug #72407: NULL Pointer Dereference at _gdScaleVert Fix bug #72402: _php_mb_regex_ereg_replace_exec - double free Fix bug #72298 pass2_no_dither out-of-bounds access Fixed #72339 Integer Overflow in _gd2GetHeader() resulting in heap overflow Fix bug #72262 - do not overflow int Fix bug #72400 and #72403 - prevent signed int overflows for string lengths Fix bug #72275: don't allow smart_str to overflow int Fix bug #72340: Double Free Courruption in wddx_deserialize update NEWS Fix #66387: Stack overflow with imagefilltoborder Skip test which is 64bits only 5.5.37 now Conflicts: configure.in ext/mcrypt/mcrypt.c ext/spl/spl_directory.c main/php_version.h
| | | * | | Fix bug #72434: ZipArchive class Use After Free Vulnerability in PHP's GC ↵Stanislav Malyshev2016-06-201-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | algorithm and unserialize
* | | | | | Fixed the UTF-8 and long path support in the streams on Windows.Anatol Belski2016-06-203-0/+60
| |_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since long the default PHP charset is UTF-8, however the Windows part is out of step with this important point. The current implementation in PHP doesn't technically permit to handle UTF-8 filepath and several other things. Till now, only the ANSI compatible APIs are being used. Here is more about it https://msdn.microsoft.com/en-us/library/windows/desktop/dd317752%28v=vs.85%29.aspx The patch fixes not only issues with multibyte filenames under incompatible codepages, but indirectly also issues with some other multibyte encodings like BIG5, Shift-JIS, etc. by providing a clean way to access filenames in UTF-8. Below is a small list of issues from the bug tracker, that are getting fixed: https://bugs.php.net/63401 https://bugs.php.net/41199 https://bugs.php.net/50203 https://bugs.php.net/71509 https://bugs.php.net/64699 https://bugs.php.net/64506 https://bugs.php.net/30195 https://bugs.php.net/65358 https://bugs.php.net/61315 https://bugs.php.net/70943 https://bugs.php.net/70903 https://bugs.php.net/63593 https://bugs.php.net/54977 https://bugs.php.net/54028 https://bugs.php.net/43148 https://bugs.php.net/30730 https://bugs.php.net/33350 https://bugs.php.net/35300 https://bugs.php.net/46990 https://bugs.php.net/61309 https://bugs.php.net/69333 https://bugs.php.net/45517 https://bugs.php.net/70551 https://bugs.php.net/50197 https://bugs.php.net/72200 https://bugs.php.net/37672 Yet more related tickets can for sure be found - on bugs.php.net, Stackoverflow and Github. Some of the bugs are pretty recent, some descend to early 2000th, but the user comments in there last even till today. Just for example, bug #30195 was opened in 2004, the latest comment in there was made in 2014. It is certain, that these bugs descend not only to pure PHP use cases, but get also redirected from the popular PHP based projects. Given the modern systems (and those supported by PHP) are always based on NTFS, there is no excuse to keep these issues unresolved. The internalization approach on Windows is in many ways different from UNIX and Linux, while it supports and is based on Unicode. It depends on the current system code page, APIs used and exact kind how the binary was compiled The locale doesn't affect the way Unicode or ANSI API work. PHP in particular is being compiled without _UNICODE defined and this is conditioned by the way we handle strings. Here is more about it https://msdn.microsoft.com/en-us/library/tsbaswba.aspx However, with any system code page ANSI functions automatically convert paths to UTF-16. Paths in some encodings incompatible with the current system code page, won't work correctly with ANSI APIs. PHP till now only uses the ANSI Windows APIs. For example, on a system with the current code page 1252, the paths in cp1252 are supported and transparently converted to UTF-16 by the ANSI functions. Once one wants to handle a filepath encoded with cp932 on that particular system, an ANSI or a POSIX compatible function used in PHP will produce an erroneous result. When trying to convert that cp932 path to UTF-8 and passing to the ANSI functions, an ANSI function would likely interpret the UTF-8 string as some string in the current code page and create a filepath that represents every single byte of the UTF-8 string. These behaviors are not only broken but also disregard the documented INI settings. This patch solves the issies with the multibyte paths on Windows by intelligently enforcing the usage of the Unicode aware APIs. For functions expect Unicode (fe CreateFileW, FindFirstFileW, etc.), arguments will be converted to UTF-16 wide chars. For functions returning Unicode aware data (fe GetCurrentDirectoryW, etc.), resulting wide string is converted back to char's depending on the current PHP charset settings, either to the current ANSI codepage (this is the behavior prior to this patch) or to UTF-8 (the default behavior). In a particular case, users might have to explicitly set internal_encoding or default_charset, if filenames in ANSI codepage are necessary. Current tests show no regressions and witness that this will be an exotic case, the current default UTF-8 encoding is compatible with any supported system. The dependency libraries are long switching to Unicode APIs, so some tests were also added for extensions not directly related to streams. At large, the patch brings over 150 related tests into the core. Those target and was run on various environments with European, Asian, etc. codepages. General PHP frameworks was tested and showed no regressions. The impact on the current C code base is low, the most places affected are the Windows only places in the three files tsrm_win32.c, zend_virtual_cwd.c and plain_wrapper.c. The actual implementation of the most of the wide char supporting functionality is in win32/ioutil.* and win32/codepage.*, several low level functionsare extended in place to avoid reimplementation for now. No performance impact was sighted. As previously mentioned, the ANSI APIs used prior the patch perform Unicode conversions internally. Using the Unicode APIs directly while doing custom conversions just retains the status quo. The ways to optimize it are open (fe. by implementing caching for the strings converted to wide variants). The long path implementation is user transparent. If a path exceeds the length of _MAX_PATH, it'll be automatically prefixed with \\?\. The MAXPATHLEN is set to 2048 bytes. Appreciation to Pierre Joye, Matt Ficken, @algo13 and others for tips, ideas and testing. Thanks.
* | | | | Merge branch 'PHP-7.0'Anatol Belski2016-05-302-0/+26
|\ \ \ \ \ | |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * PHP-7.0: fix test title Add test for bug #72258 update UPGRADING Expose missing flags from libzip at least >= 0.11.x
| * | | | fix test titleAnatol Belski2016-05-301-1/+1
| | | | |
| * | | | Add test for bug #72258Anatol Belski2016-05-302-0/+26
| | | | |
| * | | | Expose missing flags from libzip at least >= 0.11.xAnatol Belski2016-05-301-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are helpful with reading/writing zips containing non UTF-8 filenames to mitigate possibly changed libzip behaviors. Partial cherry-pick of 893c2405ff34250ffefbbc1d223de4df6c154c8a
* | | | | Expose missing flags from libzip at least >= 0.11.xAnatol Belski2016-05-251-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | These are helpful with reading/writing zips containing non UTF-8 filenames to mitigate possibly changed libzip behaviors.
* | | | | Merge branch 'PHP-7.0'Stanislav Malyshev2016-04-261-2/+2
|\ \ \ \ \ | |/ / / / | | | | | | | | | | | | | | | * PHP-7.0: Fix bug #71923 - integer overflow in ZipArchive::getFrom*
| * | | | Fix bug #71923 - integer overflow in ZipArchive::getFrom*Stanislav Malyshev2016-04-261-2/+2
| | | | |
* | | | | Merge branch 'PHP-7.0'Remi Collet2016-02-221-3/+1
|\ \ \ \ \ | |/ / / / | | | | | | | | | | | | | | | * PHP-7.0: missing include
| * | | | missing includeRemi Collet2016-02-221-3/+1
| | | | |
* | | | | Merge branch 'PHP-7.0'Remi Collet2016-02-2240-246/+751
|\ \ \ \ \ | |/ / / / | | | | | | | | | | | | | | | * PHP-7.0: update bundled libzip to 1.1.2
| * | | | update bundled libzip to 1.1.2Remi Collet2016-02-2240-246/+751
| | | | |
* | | | | Merge branch 'PHP-7.0'Remi Collet2016-02-223-4/+0
|\ \ \ \ \ | |/ / / / | | | | | | | | | | | | | | | * PHP-7.0: cleanup $Id
| * | | | Merge branch 'PHP-5.6' into PHP-7.0Remi Collet2016-02-223-4/+0
| |\ \ \ \ | | |/ / / | | | | | | | | | | | | | | | * PHP-5.6: cleanup $Id