cvs: php4 /ext/zlib zlib.c /ext/zlib/tests 001.phpt

From: Date: Tue, 12 Mar 2002 13:06:40 +0000
Subject: cvs: php4 /ext/zlib zlib.c /ext/zlib/tests 001.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-9946@lists.php.net to get a copy of this message
sr Tue Mar 12 08:06:40 2002 EDT Modified files: /php4/ext/zlib zlib.c /php4/ext/zlib/tests 001.phpt Log: (PHP gzinflate) Workaround for bug #14939 (buffer error in gzinflate()). Fixed prototype and added test for #14939. # We have extra \0 if the input comes directly from gzdeflate() # so give one extra byte as length to workaround behaviour of zlib. # I want to avoid copying the input, but if there are problems, # please tell (see my message <20020310175611.GA4472@stefan.roehri.ch> to # php-dev). Index: php4/ext/zlib/zlib.c diff -u php4/ext/zlib/zlib.c:1.106 php4/ext/zlib/zlib.c:1.107 --- php4/ext/zlib/zlib.c:1.106 Thu Feb 28 22:05:50 2002 +++ php4/ext/zlib/zlib.c Tue Mar 12 08:06:39 2002 @@ -18,7 +18,7 @@ | Jade Nicoletti <nicoletti@nns.ch> | +----------------------------------------------------------------------+ */ -/* $Id: zlib.c,v 1.106 2002/03/01 03:05:50 yohgaki Exp $ */ +/* $Id: zlib.c,v 1.107 2002/03/12 13:06:39 sr Exp $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -919,7 +919,7 @@ } /* }}} */ -/* {{{ proto string gzinflate(string data, int length) +/* {{{ proto string gzinflate(string data [, int length]) Unzip a gzip-compressed string */ PHP_FUNCTION(gzinflate) { @@ -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; Index: php4/ext/zlib/tests/001.phpt diff -u php4/ext/zlib/tests/001.phpt:1.1 php4/ext/zlib/tests/001.phpt:1.2 --- php4/ext/zlib/tests/001.phpt:1.1 Fri Jul 13 11:48:37 2001 +++ php4/ext/zlib/tests/001.phpt Tue Mar 12 08:06:40 2002 @@ -11,7 +11,16 @@ echo strlen($packed)." ".strlen($original)."\n"; $unpacked=gzinflate($packed); if (strcmp($original,$unpacked)==0) echo "Strings are equal"; + +echo "\n"; +$original = 'aaaaaaaaaaaaaaa'; +$packed=gzdeflate($original); +echo strlen($packed)." ".strlen($original)."\n"; +$unpacked=gzinflate($packed); +if (strcmp($original,$unpacked)==0) echo "Strings are equal"; ?> --EXPECT-- 100 36864 Strings are equal +5 15 +Strings are equal \ No newline at end of file

« previous php.cvs (#9946) next »