Bug #12091 Updated: zlib uncompress buffer error/ inflate failed

From: Date: Fri, 13 Jul 2001 17:33:49 +0000
Subject: Bug #12091 Updated: zlib uncompress buffer error/ inflate failed
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-59984@lists.php.net to get a copy of this message
ID: 12091
User updated by: alberty@neptunlabs.de
Reported By: alberty@neptunlabs.de
Status: Closed
Bug Type: Zlib Related
Operating System: i686-pc-linux-gnu
PHP Version: 4.0CVS-2001-07-12
New Comment:

Hi Thies,

thank you for your changes in zlib.c but you have not
really fix the problem.
If i increase the string repeating from 5000 to 35000,
i have the same problem again, but
i don't no why, sometimes php works correct...

<---snip--->
<tt>
<?php
error_reporting(63);
mt_srand ((double) microtime() * 1000000);

for ($original="",$i=0;$i<35000;$i++){
	//$out.=chr(mt_rand()); // 
	$original.="lala "; // problem
}

$packed=gzdeflate($original); // gzcompress
$unpacked=gzinflate($packed); // gzuncompress

echo "Length original:".strlen($original)."<br>";
echo "Length packed:".strlen($packed)."<br>";
echo "Length unpacked:".strlen($unpacked)."<br>";

if (strcmp($original,$unpacked)==0) echo "Strings are equal";
else echo "<b>Strings <u>not</u> equal</b>";
?>
</tt>
<---snap--->


Regards,

-- 
Steve

Previous Comments:
------------------------------------------------------------------------

[2001-07-13 11:15:07] thies@php.net

fixed in CVS


you can make it work in 4.0.6 by changing maxfactor from 8 
to lets say 16 in zlib.c around line 912



------------------------------------------------------------------------

[2001-07-12 05:38:24] alberty@neptunlabs.de

Hi,

the follow code produces a deflated string
which php can not inflate.


php results:
"Warning: gzinflate: buffer error in /web/htdocs/thisfile.php"

----
<tt>
<?php
error_reporting(63);
mt_srand ((double) microtime() * 1000000);

for ($original="",$i=0;$i<5000;$i++){
	//$original.=chr(mt_rand()); // 
	$original.="lala "; // problem
}

$packed=gzdeflate($original); // gzcompress
$unpacked=gzinflate($packed); // gzuncompress

echo "Length original:".strlen($original)."<br>";
echo "Length packed:".strlen($packed)."<br>";
echo "Length unpacked:".strlen($unpacked)."<br>";

if (strcmp($original,$unpacked)==0) echo "Strings are equal";
else echo "<b>Strings <u>not</u> equal</b>";
?>
</tt>
----


Regards,


-- 
Steve

------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=12091&edit=1



Thread (6 messages)

« previous php.dev (#59984) next »