php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12091 zlib uncompress buffer error/ inflate failed
Submitted: 2001-07-12 05:38 UTC Modified: 2002-01-02 20:12 UTC
From: alberty at neptunlabs dot de Assigned:
Status: Closed Package: Zlib related
PHP Version: 4.0CVS-2001-07-12 OS: i686-pc-linux-gnu
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: alberty at neptunlabs dot de
New email:
PHP Version: OS:

 

 [2001-07-12 05:38 UTC] alberty at neptunlabs dot 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-13 11:15 UTC] 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-13 13:33 UTC] alberty at neptunlabs dot de
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
 [2001-11-03 22:42 UTC] sniper@php.net
missing status

 [2002-01-02 20:12 UTC] mfischer@php.net
I'm pretending this is fixed as I can't reproduce it with current CVS (reopen with sample script if wrong).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 03:01:29 2024 UTC