#30153 [Bgs->Opn]: FATAL erealloc() error when using gzinflate()
| From: | OvdSpek at LIACS dot NL | Date: | Thu, 30 Sep 2004 21:54:49 +0000 |
| Subject: | #30153 [Bgs->Opn]: FATAL erealloc() error when using gzinflate() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-66960@lists.php.net to get a copy of this message | ||
ID: 30153
User updated by: OvdSpek at LIACS dot NL
Reported By: OvdSpek at LIACS dot NL
-Status: Bogus
+Status: Open
Bug Type: Zlib Related
Operating System: *
PHP Version: 4CVS, 5CVS (20040929)
New Comment:
Am I really the only one that does not find this an acceptable
solution?
The documentation states that this function will return an error and
that's what I expect. I do not expect my script to terminate.
> The function will return an error if the uncompressed data is more
than 32768 times the length of the compressed input data or more than
the optional parameter length.
Previous Comments:
------------------------------------------------------------------------
[2004-09-30 23:39:51] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Decompressing the specified file with non-php tools tells me that the
data is corrupt. As far as the error itself, according to the gzip
library return statuses the file's compression exceeds that of 1 to
32768 which is defined as upper limit. So this sort of behaviour is
expected. PHP cannot terminate nicely since the data size * 32768 still
tries to make PHP allocate too much memory, which results in graceful
request termination.
------------------------------------------------------------------------
[2004-09-28 23:10:59] sniper@php.net
# php -dmemory_limit=100000000000000000000 t.php
Allowed memory size of 2147483647 bytes exhausted at
/usr/src/web/php/php4/ext/zlib/zlib.c:628 (tried to allocate 1207205888
bytes)
------------------------------------------------------------------------
[2004-09-24 21:25:56] OvdSpek at LIACS dot NL
The bug is in 4.3.9 final too.
------------------------------------------------------------------------
[2004-09-19 16:17:24] OvdSpek at LIACS dot NL
Description:
------------
The following PHP script appears to cause a full crash/restart of my
Apache/2.0.50 (Win32) PHP/4.3.9RC3 Server at localhost Port 80 server
on Windows XP.
http://213.46.64.114/temp/php_crash.bin
http://62.216.18.38/temp/php_crash.bin
Reproduce code:
---------------
<?php
$s = file_get_contents('f:/temp/php_crash.bin');
gzinflate(substr($s, 10));
?>
Expected result:
----------------
No errors.
Actual result:
--------------
FATAL: erealloc(): Unable to allocate 603602944 bytes
[Sun Sep 19 16:11:16 2004] [notice] Parent: child process exited with
status 1 -- Restarting.
[Sun Sep 19 16:11:16 2004] [notice] Parent: Created child process 3908
[Sun Sep 19 16:11:16 2004] [notice] Child 3908: Child process is
running
[Sun Sep 19 16:11:16 2004] [notice] Child 3908: Acquired the start
mutex.
[Sun Sep 19 16:11:16 2004] [notice] Child 3908: Starting 250 worker
threads.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30153&edit=1