svn: /php/php-src/branches/PHP_5_4/ NEWS ext/zlib/php_zlib.h ext/zlib/tests/bug61287.phpt ext/zlib/zlib.c
| From: | Michael Wallner | Date: | Mon, 05 Mar 2012 15:38:24 +0000 |
| Subject: | svn: /php/php-src/branches/PHP_5_4/ NEWS ext/zlib/php_zlib.h ext/zlib/tests/bug61287.phpt ext/zlib/zlib.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-67833@lists.php.net to get a copy of this message | ||
mike Mon, 05 Mar 2012 15:38:24 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=323917
Log:
MFH: Fixed bug #61287 (A particular string fails to decompress)
Bug: https://bugs.php.net/61287 (Assigned) A particular
string fails to decompress
Changed paths:
U php/php-src/branches/PHP_5_4/NEWS
U php/php-src/branches/PHP_5_4/ext/zlib/php_zlib.h
A + php/php-src/branches/PHP_5_4/ext/zlib/tests/bug61287.phpt
(from php/php-src/trunk/ext/zlib/tests/bug61287.phpt:r323916)
U php/php-src/branches/PHP_5_4/ext/zlib/zlib.c
Modified: php/php-src/branches/PHP_5_4/NEWS
===================================================================
--- php/php-src/branches/PHP_5_4/NEWS 2012-03-05 15:35:22 UTC (rev 323916)
+++ php/php-src/branches/PHP_5_4/NEWS 2012-03-05 15:38:24 UTC (rev 323917)
@@ -61,6 +61,7 @@
- Zlib:
. Fixed bug #61139 (gzopen leaks when specifying invalid mode). (Nikita Popov)
+ . Fixed bug #61287 (A particular string fails to decompress). (Mike)
01 Mar 2012, PHP 5.4.0
Modified: php/php-src/branches/PHP_5_4/ext/zlib/php_zlib.h
===================================================================
--- php/php-src/branches/PHP_5_4/ext/zlib/php_zlib.h 2012-03-05 15:35:22 UTC (rev 323916)
+++ php/php-src/branches/PHP_5_4/ext/zlib/php_zlib.h 2012-03-05 15:38:24 UTC (rev 323917)
@@ -65,6 +65,7 @@
#define phpext_zlib_ptr zlib_module_ptr
#ifdef ZTS
+# include "TSRM.h"
# define ZLIBG(v) TSRMG(zlib_globals_id, zend_zlib_globals *, v)
#else
# define ZLIBG(v) (zlib_globals.v)
Copied: php/php-src/branches/PHP_5_4/ext/zlib/tests/bug61287.phpt (from rev 323916,
php/php-src/trunk/ext/zlib/tests/bug61287.phpt)
===================================================================
--- php/php-src/branches/PHP_5_4/ext/zlib/tests/bug61287.phpt (rev 0)
+++ php/php-src/branches/PHP_5_4/ext/zlib/tests/bug61287.phpt 2012-03-05 15:38:24 UTC (rev 323917)
@@ -0,0 +1,24 @@
+--TEST--
+bug #61287 - inflate needs the terminating null byte
+--SKIPIF--
+<?php extension_loaded("zlib") or die("SKIP need zlib");
+--FILE--
+<?php
+$array = array(
+ 'region_id' => 1,
+ 'discipline' => 23,
+ 'degrees' => array(),
+ 'country_id' => 27
+);
+
+$serialized = serialize($array);
+
+$deflated = gzdeflate($serialized, 9);
+$inflated = gzinflate($deflated);
+
+echo strlen($inflated),"\n";
+?>
+Done
+--EXPECT--
+92
+Done
Modified: php/php-src/branches/PHP_5_4/ext/zlib/zlib.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/zlib/zlib.c 2012-03-05 15:35:22 UTC (rev 323916)
+++ php/php-src/branches/PHP_5_4/ext/zlib/zlib.c 2012-03-05 15:38:24 UTC (rev 323917)
@@ -400,7 +400,7 @@
status = inflateInit2(&Z, encoding);
if (Z_OK == status) {
Z.next_in = (Bytef *) in_buf;
- Z.avail_in = in_len;
+ Z.avail_in = in_len + 1; /* NOTE: data must be zero terminated */
switch (status = php_zlib_inflate_rounds(&Z, max_len, out_buf, out_len)) {
case Z_STREAM_END: