Skip to content

Commit

Permalink
Better fix bug #75540 Segfault with libzip 1.3.1
Browse files Browse the repository at this point in the history
- only 1.3.1 is affected
- fix use after free
  • Loading branch information
remicollet committed Nov 20, 2017
1 parent 8832c46 commit 702ef27
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ext/zip/php_zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 702ef27

Please sign in to comment.