ID: 42663 Updated by: [EMAIL PROTECTED] Reported By: arnaud dot lb at gmail dot com -Status: Open +Status: Feedback Bug Type: Zlib Related Operating System: Linux 2.6 PHP Version: 5.2.4 New Comment:
Can you please provide a URL to the file with corrupted data. Previous Comments: ------------------------------------------------------------------------ [2007-09-13 18:33:23] arnaud dot lb at gmail dot com Example code in a more readable format: <?php ini_set('memory_limit', -1); // compressing a ~1.6MB file with gzdeflate() $data = gzdeflate(file_get_contents("/home/noch/yuicompressor-1.0.zip"), 9); echo "Compressed length: " . strlen($data) . "\n"; // gzinflate() works with original $data gzinflate($data); // Truncating compressed $data $data = substr($data, 0, 65535); echo "Truncated length: " . strlen($data) . "\n"; // Bug is here: gzinflate($data); ?> ------------------------------------------------------------------------ [2007-09-13 18:28:28] arnaud dot lb at gmail dot com 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 this bug report at http://bugs.php.net/?id=42663&edit=1