php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14939 Warning: gzinflate: buffer error in /usr/local/apache/elca_rmg/class.FTemplateE
Submitted: 2002-01-08 21:04 UTC Modified: 2002-03-12 08:37 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: bobg at cableone dot net Assigned: sr (profile)
Status: Closed Package: Zlib related
PHP Version: 4.1.1 OS: Apache
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bobg at cableone dot net
New email:
PHP Version: OS:

 

 [2002-01-08 21:04 UTC] bobg at cableone dot net
Receive the following error with only 15 consecutive characters entered.

Warning: gzinflate: buffer error in /usr/local/apache/elca_rmg/class.FTemplateExt.php on line 153

What follows is the code updating the SQL files:

$gzsize = strlen($description) + 4;  // added 4 more than req'd
$gzcompress = gzdeflate ($description,6);
$gzcompress = addslashes($gzcompress);  //Reqd for SQL updates

$query = "UPDATE htmlcontent SET record_nbr = \"$record_nbr\", gzcompress = \"$gzcompress\", gzsize = $gzsize WHERE record_nbr = \"$record_nbr\"";
                  }
general_update($errno,$errmsg,$rowsaffected, $result, $s_synod_id, $query);   // UPDATE the record

*******************************************************
Next I attempt to read the record back and unzip gzcompress
Note that $description consists of 20 'a' characters.  Any repetitive char will do and only 15 to 20 are req'd
*******************************************************

$query = "SELECT * FROM htmlcontent WHERE record_nbr = \"$record_nbr\"";
       
general_read($errno, $errmsg,$numrows, $result_html, $s_synod_id, $query);
       
if  ($numrows > 0) {
    if ($row_html = mysql_fetch_array ($result_html)) {
         $content = stripslashes($row_html["gzcompress"]);
         if (strlen($content) > 0) {
******Error occurs on the following instruction*********
            $new = gzinflate($content,$row_html["gzsize"]);
            

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-07 08:06 UTC] lobbin@php.net
Does this script work if you don't provide a compression level?


-- robin
 [2002-03-07 17:24 UTC] sr@php.net
Does the attached patch help?

--- /home/sr/cvs/php/php4/ext/zlib/zlib.c       Thu Mar  7 16:38:26 2002
+++ ext/zlib/zlib.c     Thu Mar  7 23:15:48 2002
@@ -967,7 +967,7 @@
                if(! s2) { if(s1) efree(s1); RETURN_FALSE; }
 
                stream.next_in = (Bytef*) Z_STRVAL_PP(data);
-               stream.avail_in = (uInt) Z_STRLEN_PP(data);
+               stream.avail_in = (uInt) Z_STRLEN_PP(data) + 1; /* there is room for \0 */
 
                stream.next_out = s2;
                stream.avail_out = (uInt) length;

(If there are broken line breaks and you can't apply it, change the line stream.avail_in = (uInt) Z_STRLEN_PP(data) to ...(data)+1 in the gzinflate function).

Please report if it works (and if it doesn't break other things). This seems to be a rather strange thing in the zlib library ...

 [2002-03-12 08:37 UTC] sr@php.net
Should be fixed in latest cvs version.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 16:01:28 2024 UTC