com php-src: Better fix bug #75540 Segfault with libzip 1.3.1 - only 1.3.1 is affected - fix use after free: ext/zip/php_zip.c
| From: | Remi Collet | Date: | Mon, 20 Nov 2017 08:42:20 +0000 |
| Subject: | com php-src: Better fix bug #75540 Segfault with libzip 1.3.1 - only 1.3.1 is affected - fix use after free: ext/zip/php_zip.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-100314@lists.php.net to get a copy of this message | ||
Commit: 702ef2736479af85ce17aec83c6cfc1fecccf326
Author: Remi Collet <remi@php.net> Mon, 20 Nov 2017 09:42:20 +0100
Parents: 8832c46607cd9e9a143d954a10dfec2b61295bbb
Branches: PHP-7.0 PHP-7.1 PHP-7.2 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=702ef2736479af85ce17aec83c6cfc1fecccf326
Log:
Better fix bug #75540 Segfault with libzip 1.3.1
- only 1.3.1 is affected
- fix use after free
Bugs:
https://bugs.php.net/75540
Changed paths:
M ext/zip/php_zip.c
Diff:
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index f439340..aee355b 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -1513,9 +1513,10 @@ static ZIPARCHIVE_METHOD(close)
ze_obj = Z_ZIP_P(self);
if ((err = zip_close(intern))) {
+#if LIBZIP_VERSION_MAJOR == 1 && LIBZIP_VERSION_MINOR == 3 && LIBZIP_VERSION_MICRO
== 1
+ php_error_docref(NULL, E_WARNING, "%s", "zip_close have failed");
+#else
php_error_docref(NULL, E_WARNING, "%s", zip_strerror(intern));
-#if LIBZIP_VERSION_MAJOR < 1 || (LIBZIP_VERSION_MAJOR == 1 && LIBZIP_VERSION_MINOR <
3) || (LIBZIP_VERSION_MAJOR == 1 && LIBZIP_VERSION_MINOR == 3 &&
LIBZIP_VERSION_MICRO < 1)
- /* Fix memory leak in libzip < 1.3.1 */
zip_discard(intern);
#endif
}