On Fri, Jul 13, 2001 at 05:33:49PM -0000, [EMAIL PROTECTED] wrote:
> ID: 12091
> User updated by: [EMAIL PROTECTED]
> Reported By: [EMAIL PROTECTED]
> 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...
this "algorithm" that sets the output buffer size is *not*
perfect. from the source:
/*
zlib::uncompress() wants to know the output data length
if none was given as a parameter
we try from input length * 2 up to input length * 2^16
doubling it whenever it wasn't big enough
that should be eneugh for all real life cases
*/
so - yes there are some situation where it might fail. but i
don't think that anybody will get hit by it in real-life. we
could bump the maxfactor even more - but the clean approach
would be to make the code smarter.
so yes - we still have a possible bug - but it's very
unlikely to get hit by it, right?
tc
>
> <---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] [EMAIL PROTECTED]
>
> 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] [EMAIL PROTECTED]
>
> 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
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]