From: arnaud dot lb at gmail dot com Operating system: Linux 2.6 PHP version: 5.2.4 PHP Bug Type: Zlib Related Bug description: gzinflate() try to allocate all memory with truncated $data
Description: ------------ gzinflate() try to allocate all memory with truncated $data: Fatal error: Out of memory (allocated 1074003968) (tried to allocate 2147450880 bytes) in Command line code on line 1 Zlib version: 1.2.3.3 Reproduce code: --------------- /tmp/php-5.2.4$ ./configure --disable-all --enable-cli --with-zlib && make -j4 /tmp/php-5.2.4$ sapi/cli/php -d memory_limit=-1 -r '$data = gzdeflate(file_get_contents("/tmp/yuicompressor-1.0.zip"), 9); echo "Compressed length: " . strlen($data) . "\n"; gzinflate($data); $data = substr($data, 0, 65535); echo "Truncated length: " . strlen($data) . "\n"; gzinflate($data);' Expected result: ---------------- gzinflate() should return FALSE, without eating all memory Actual result: -------------- Fatal error: Out of memory (allocated 1074003968) (tried to allocate 2147450880 bytes) in Command line code on line 1 -- Edit bug report at http://bugs.php.net/?id=42663&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42663&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42663&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42663&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42663&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42663&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42663&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42663&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42663&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42663&r=support Expected behavior: http://bugs.php.net/fix.php?id=42663&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42663&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42663&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42663&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42663&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42663&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42663&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42663&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42663&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42663&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42663&r=mysqlcfg