#34191 [Csd->Opn]: ob_gzhandler does not enforce trailing NUL
| From: | mike@php.net | Date: | Wed, 24 Aug 2005 08:26:50 +0000 |
| Subject: | #34191 [Csd->Opn]: ob_gzhandler does not enforce trailing NUL | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-83926@lists.php.net to get a copy of this message | ||
ID: 34191
User updated by: mike@php.net
Reported By: mike@php.net
-Status: Closed
+Status: Open
Bug Type: Zlib Related
PHP Version: 5CVS-2005-08-19 (CVS)
New Comment:
Sorry, the commit does not fix the problem right, the buffer should be
NUL terminated in any case, shouldn't it?
Reproduce Script:
<?php
function f()
{
$data = ob_get_contents();
while(@ob_end_clean());
ob_start('ob_gzhandler');
$step = strlen($data)/2;
echo substr($data, 0, $step);
ob_flush();
echo substr($data, $step);
}
register_shutdown_function('f');
while(@ob_end_clean());
ob_start();
echo '<pre>';
readfile(__FILE__);
?>
Previous Comments:
------------------------------------------------------------------------
[2005-08-21 18:05:34] iliaa@php.net
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
------------------------------------------------------------------------
[2005-08-19 14:38:04] mike@php.net
Reproducing script:
<?php
function f()
{
$data = ob_get_contents();
while(@ob_end_clean());
ob_start('ob_gzhandler');
$step = strlen($data)/2;
echo substr($data, 0, $step);
ob_flush();
echo substr($data, $step);
}
register_shutdown_function('f');
ob_start();
echo '<pre>';
readfile(__FILE__);
?>
------------------------------------------------------------------------
[2005-08-19 13:41:44] mike@php.net
Description:
------------
ob_gzhandler does not always append a trailing NUL byte to the deflated
string, resulting in warnings in debug mode.
PATCH:
http://dev.iworks.at/PATCHES/ob_gzhandler_trailing_NUL.txt
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34191&edit=1