mirror of
https://github.com/php/php-src.git
synced 2025-01-26 13:44:22 +08:00
fix bug 53885 (ZipArchive segfault with FL_UNCHANGED on empty archive)
This commit is contained in:
parent
6e57a7792e
commit
4a2b458835
2
NEWS
2
NEWS
@ -154,6 +154,8 @@
|
||||
. Fixed bug #53603 (ZipArchive should quiet stat errors). (brad dot froehle at
|
||||
gmail dot com, Gustavo)
|
||||
. Fixed bug #53854 (Missing constants for compression type). (Richard, Adam)
|
||||
. Fixed bug #53885 (ZipArchive segfault with FL_UNCHANGED on empty archive).
|
||||
(Stas, Maksymilian Arciemowicz).
|
||||
|
||||
06 Jan 2011, PHP 5.3.5
|
||||
- Fixed Bug #53632 (infinite loop with x87 fpu). (CVE-2010-4645) (Scott,
|
||||
|
@ -60,6 +60,10 @@ _zip_name_locate(struct zip *za, const char *fname, int flags,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if((flags & ZIP_FL_UNCHANGED) && !za->cdir) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
cmp = (flags & ZIP_FL_NOCASE) ? strcmpi : strcmp;
|
||||
|
||||
n = (flags & ZIP_FL_UNCHANGED) ? za->cdir->nentry : za->nentry;
|
||||
|
19
ext/zip/tests/bug53885.phpt
Normal file
19
ext/zip/tests/bug53885.phpt
Normal file
@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Bug #53885 (ZipArchive segfault with FL_UNCHANGED on empty archive)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if(!extension_loaded('zip')) die('skip');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$fname = dirname(__FILE__)."/test53885.zip";
|
||||
if(file_exists($fname)) unlink($fname);
|
||||
touch($fname);
|
||||
$nx=new ZipArchive();
|
||||
$nx->open($fname);
|
||||
$nx->locateName("a",ZIPARCHIVE::FL_UNCHANGED);
|
||||
$nx->statName("a",ZIPARCHIVE::FL_UNCHANGED);
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECTF--
|
||||
==DONE==
|
Loading…
Reference in New Issue
Block a user