diff options
author | timurib <timok@ya.ru> | 2018-06-25 14:14:26 +0300 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2018-07-10 11:18:37 +0200 |
commit | 08f08858f3bc62fac9150ca5b669df060b5af5a5 (patch) | |
tree | 1881036b6f672c47053e37212300b184b8437c93 /ext/zip/php_zip.c | |
parent | a820aab9da3389e3df5711306d05660d8bf35ff0 (diff) | |
download | php-git-08f08858f3bc62fac9150ca5b669df060b5af5a5.tar.gz |
Fix bug #76524 - ZipArchive memory leak
Bugfix #76524: Free up zip internal state and adjust the tests for Windows
Bugfix #76524: Fix possible use after free for libzip 1.3.1
Bugfix #76524: Make the test independent of platform
Diffstat (limited to 'ext/zip/php_zip.c')
-rw-r--r-- | ext/zip/php_zip.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index ade0b99173..cdf77f20cd 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -1003,10 +1003,13 @@ static void php_zip_object_free_storage(zend_object *object) /* {{{ */ } if (intern->za) { if (zip_close(intern->za) != 0) { +#if LIBZIP_VERSION_MAJOR == 1 && LIBZIP_VERSION_MINOR == 3 && LIBZIP_VERSION_MICRO == 1 + php_error_docref(NULL, E_WARNING, "Cannot destroy the zip context: %s", "zip_close have failed"); +#else php_error_docref(NULL, E_WARNING, "Cannot destroy the zip context: %s", zip_strerror(intern->za)); - return; + zip_discard(intern->za); +#endif } - intern->za = NULL; } if (intern->buffers_cnt>0) { |