diff options
author | Anatol Belski <ab@php.net> | 2013-03-20 09:15:46 +0100 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2013-03-20 09:15:46 +0100 |
commit | 7daabc42a2811bb995bb2e8056e992fd8b8b48d7 (patch) | |
tree | 3a21f1410d11e6fa4e10c5470c3c07c0c607a056 /ext/zip | |
parent | b5a7675836284d1202a5c4143f3654af72ea8f31 (diff) | |
parent | bf8026aacf6ebeafca9c78928e3e660d7698ff6a (diff) | |
download | php-git-7daabc42a2811bb995bb2e8056e992fd8b8b48d7.tar.gz |
Merge branch 'PHP-5.5'
* PHP-5.5:
updated NEWS
updated NEWS
Fixed bug #64452 Zip PHPTs crash intermittently
Diffstat (limited to 'ext/zip')
-rw-r--r-- | ext/zip/lib/zip_close.c | 6 | ||||
-rw-r--r-- | ext/zip/lib/zip_dirent.c | 12 |
2 files changed, 14 insertions, 4 deletions
diff --git a/ext/zip/lib/zip_close.c b/ext/zip/lib/zip_close.c index 362f92d749..e66c56697b 100644 --- a/ext/zip/lib/zip_close.c +++ b/ext/zip/lib/zip_close.c @@ -88,6 +88,9 @@ zip_close(struct zip *za) if (za == NULL) return -1; + if (za->zp == NULL) + return -1; + if (!_zip_changed(za, &survivors)) { _zip_free(za); return 0; @@ -164,9 +167,10 @@ zip_close(struct zip *za) for (j=0; j<survivors; j++) { i = filelist[j].idx; + _zip_dirent_init(&de); + /* create new local directory entry */ if (ZIP_ENTRY_DATA_CHANGED(za->entry+i) || new_torrentzip) { - _zip_dirent_init(&de); if (zip_get_archive_flag(za, ZIP_AFL_TORRENT, 0)) _zip_dirent_torrent_normalize(&de); diff --git a/ext/zip/lib/zip_dirent.c b/ext/zip/lib/zip_dirent.c index b5b9d273be..b9dac5c989 100644 --- a/ext/zip/lib/zip_dirent.c +++ b/ext/zip/lib/zip_dirent.c @@ -157,11 +157,17 @@ _zip_cdir_write(struct zip_cdir *cd, FILE *fp, struct zip_error *error) void _zip_dirent_finalize(struct zip_dirent *zde) { - free(zde->filename); + if (zde->filename_len > 0) { + free(zde->filename); + } zde->filename = NULL; - free(zde->extrafield); + if (zde->extrafield_len > 0) { + free(zde->extrafield); + } zde->extrafield = NULL; - free(zde->comment); + if (zde->comment_len > 0) { + free(zde->comment); + } zde->comment = NULL; } |