[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/bz2 bz2_filter.c

2009-02-08 Thread Greg Beaver
cellog  Mon Feb  9 03:44:59 2009 UTC

  Modified files:  (Branch: PHP_5_2)
/php-srcNEWS 
/php-src/ext/bz2bz2_filter.c 
  Log:
  MFB fix Bug #46026 (this is a refinement of the previous fix)
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1411&r2=1.2027.2.547.2.1412&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1411 php-src/NEWS:1.2027.2.547.2.1412
--- php-src/NEWS:1.2027.2.547.2.1411Fri Feb  6 10:42:54 2009
+++ php-src/NEWSMon Feb  9 03:44:58 2009
@@ -2,6 +2,8 @@
 |||
 ?? Feb 2009, PHP 5.2.9
 - Fixed bug #47322 (sscanf %d doesn't work). (Felipe)
+- Fixed bug #46026 (bz2.decompress/zlib.inflate filter tries to decompress 
after
+  end of stream). (Greg)
 
 02 Feb 2009, PHP 5.2.9RC1
 - Changed __call() to be invoked on private/protected method access, similar to
http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/bz2_filter.c?r1=1.3.2.2.2.11&r2=1.3.2.2.2.12&diff_format=u
Index: php-src/ext/bz2/bz2_filter.c
diff -u php-src/ext/bz2/bz2_filter.c:1.3.2.2.2.11 
php-src/ext/bz2/bz2_filter.c:1.3.2.2.2.12
--- php-src/ext/bz2/bz2_filter.c:1.3.2.2.2.11   Wed Dec 31 11:17:35 2008
+++ php-src/ext/bz2/bz2_filter.cMon Feb  9 03:44:59 2009
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: bz2_filter.c,v 1.3.2.2.2.11 2008/12/31 11:17:35 sebastian Exp $ */
+/* $Id: bz2_filter.c,v 1.3.2.2.2.12 2009/02/09 03:44:59 cellog Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -332,10 +332,13 @@
}
 
if (tmpzval) {
-   SEPARATE_ZVAL(tmpzval);
-   convert_to_boolean_ex(tmpzval);
-   smallFootprint = Z_LVAL_PP(tmpzval);
-   zval_ptr_dtor(tmpzval);
+   zval tmp, *tmp2;
+
+   tmp = **tmpzval;
+   zval_copy_ctor(&tmp);
+   tmp2 = &tmp;
+   convert_to_boolean_ex(&tmp2);
+   smallFootprint = Z_LVAL(tmp);
}
}
 
@@ -352,26 +355,31 @@
if (Z_TYPE_P(filterparams) == IS_ARRAY || 
Z_TYPE_P(filterparams) == IS_OBJECT) {
if (zend_hash_find(HASH_OF(filterparams), 
"blocks", sizeof("blocks"), (void**) &tmpzval) == SUCCESS) {
/* How much memory to allocate (1 - 9) 
x 100kb */
-   SEPARATE_ZVAL(tmpzval);
-   convert_to_long_ex(tmpzval);
-   if (Z_LVAL_PP(tmpzval) < 1 || 
Z_LVAL_PP(tmpzval) > 9) {
+   zval tmp;
+   
+   tmp = **tmpzval;
+   zval_copy_ctor(&tmp);
+   convert_to_long(&tmp);
+   if (Z_LVAL(tmp) < 1 || Z_LVAL(tmp) > 9) 
{
php_error_docref(NULL 
TSRMLS_CC, E_WARNING, "Invalid parameter given for number of blocks to 
allocate. (%ld)", Z_LVAL_PP(tmpzval));
} else {
-   blockSize100k = 
Z_LVAL_PP(tmpzval);
+   blockSize100k = Z_LVAL(tmp);
}
-   zval_ptr_dtor(tmpzval);
}
 
if (zend_hash_find(HASH_OF(filterparams), 
"work", sizeof("work"), (void**) &tmpzval) == SUCCESS) {
/* Work Factor (0 - 250) */
-   SEPARATE_ZVAL(tmpzval);
-   convert_to_long_ex(tmpzval);
-   if (Z_LVAL_PP(tmpzval) < 0 || 
Z_LVAL_PP(tmpzval) > 250) {
-   php_error_docref(NULL 
TSRMLS_CC, E_WARNING, "Invalid parameter given for work factor. (%ld)", 
Z_LVAL_PP(tmpzval));
+   zval tmp;
+   
+   tmp = **tmpzval;
+   zval_copy_ctor(&tmp);
+   convert_to_long(&tmp);
+
+   if (Z_LVAL(tmp) < 0 || Z_LVAL(tmp) > 
250) {
+   php_error_docref(NULL 
TSRMLS_CC, E_WARNING, "Invalid parameter given for work factor. (%ld)", 
Z_LVAL(tmp));
} else {
-   workFactor = Z_LVAL_PP(tmpzval);
+

[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/bz2 bz2_filter.c /ext/zlib zlib_filter.c

2008-10-11 Thread Greg Beaver
cellog  Sat Oct 11 19:12:11 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-srcNEWS 
/php-src/ext/zlib   zlib_filter.c 
/php-src/ext/bz2bz2_filter.c 
  Log:
  fix Bug #46026: bz2.decompress/zlib.inflate filter tries to decompress after 
end of stream
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1251&r2=1.2027.2.547.2.1252&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1251 php-src/NEWS:1.2027.2.547.2.1252
--- php-src/NEWS:1.2027.2.547.2.1251Fri Oct 10 16:49:26 2008
+++ php-src/NEWSSat Oct 11 19:12:11 2008
@@ -5,6 +5,8 @@
   and $this->$method()). (Dmitry)
 - Fixed bug #46139 (PDOStatement->setFetchMode() forgets FETCH_PROPS_LATE).
   (chsc at peytz dot dk, Felipe)
+- Fixed bug #46026 (bzip2.decompress/zlib.inflate filter tries to decompress
+  after end of stream). (Keisial at gmail dot com, Greg)
 - Fixed bug #44251, #41125 (PDO + quote() + prepare() can result in seg fault).
   (tsteiner at nerdclub dot net)
 
http://cvs.php.net/viewvc.cgi/php-src/ext/zlib/zlib_filter.c?r1=1.6.2.2.2.11&r2=1.6.2.2.2.12&diff_format=u
Index: php-src/ext/zlib/zlib_filter.c
diff -u php-src/ext/zlib/zlib_filter.c:1.6.2.2.2.11 
php-src/ext/zlib/zlib_filter.c:1.6.2.2.2.12
--- php-src/ext/zlib/zlib_filter.c:1.6.2.2.2.11 Tue Feb 12 23:29:18 2008
+++ php-src/ext/zlib/zlib_filter.c  Sat Oct 11 19:12:11 2008
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: zlib_filter.c,v 1.6.2.2.2.11 2008/02/12 23:29:18 cellog Exp $ */
+/* $Id: zlib_filter.c,v 1.6.2.2.2.12 2008/10/11 19:12:11 cellog Exp $ */
 
 #include "php.h"
 #include "php_zlib.h"
@@ -31,6 +31,7 @@
size_t inbuf_len;
char *outbuf;
size_t outbuf_len;
+   zend_bool finished;
 } php_zlib_filter_data;
 
 /* }}} */
@@ -81,6 +82,12 @@
 
bucket = php_stream_bucket_make_writeable(buckets_in->head 
TSRMLS_CC);
while (bin < bucket->buflen) {
+
+   if (data->finished) {
+   consumed += bucket->buflen;
+   break;
+   }
+
desired = bucket->buflen - bin;
if (desired > data->inbuf_len) {
desired = data->inbuf_len;
@@ -89,7 +96,10 @@
data->strm.avail_in = desired;
 
status = inflate(&(data->strm), flags & 
PSFS_FLAG_FLUSH_CLOSE ? Z_FINISH : Z_SYNC_FLUSH);
-   if (status != Z_OK && status != Z_STREAM_END) {
+   if (status == Z_STREAM_END) {
+   inflateEnd(&(data->strm));
+   data->finished = '\1';
+   } else if (status != Z_OK) {
/* Something bad happened */
php_stream_bucket_delref(bucket TSRMLS_CC);
return PSFS_ERR_FATAL;
@@ -118,7 +128,7 @@
php_stream_bucket_delref(bucket TSRMLS_CC);
}
 
-   if (flags & PSFS_FLAG_FLUSH_CLOSE) {
+   if (!data->finished && flags & PSFS_FLAG_FLUSH_CLOSE) {
/* Spit it out! */
status = Z_OK;
while (status == Z_OK) {
@@ -146,7 +156,9 @@
 {
if (thisfilter && thisfilter->abstract) {
php_zlib_filter_data *data = thisfilter->abstract;
-   inflateEnd(&(data->strm));
+   if (!data->finished) {
+   inflateEnd(&(data->strm));
+   }
pefree(data->inbuf, data->persistent);
pefree(data->outbuf, data->persistent);
pefree(data, data->persistent);
@@ -330,6 +342,7 @@
}
 
/* RFC 1951 Inflate */
+   data->finished = '\0';
status = inflateInit2(&(data->strm), windowBits);
fops = &php_zlib_inflate_ops;
} else if (strcasecmp(filtername, "zlib.deflate") == 0) {
http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/bz2_filter.c?r1=1.3.2.2.2.9&r2=1.3.2.2.2.10&diff_format=u
Index: php-src/ext/bz2/bz2_filter.c
diff -u php-src/ext/bz2/bz2_filter.c:1.3.2.2.2.9 
php-src/ext/bz2/bz2_filter.c:1.3.2.2.2.10
--- php-src/ext/bz2/bz2_filter.c:1.3.2.2.2.9Sat Jan 12 22:04:03 2008
+++ php-src/ext/bz2/bz2_filter.cSat Oct 11 19:12:11 2008
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: bz2_filter.c,v 1.3.2.2.2.9 2008/01/12 22:04:03 cellog Exp $ */
+/* $Id: bz2_filter.c,v 1.3.2.2.2.10 2008/10/11 19:12:11 cellog Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -34,6 +34,7 @@
size_t inbuf_len;
char *outbuf;
size_t outbuf_len;
+   zend_bool finished;
 } php_bz2_filter_data;
 
 /* }}} */
@@ -82,6 +83,11 @@
 
bucket = php_stream_bucket_make_writeable(buckets_in->h

[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/bz2 bz2_filter.c

2007-12-16 Thread Ilia Alshanetsky
iliaa   Sun Dec 16 17:22:32 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/bz2bz2_filter.c 
/php-srcNEWS 
  Log:
  MFB: Fixed bug #43589 (a possible infinite loop in bz2_filter.c)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/bz2_filter.c?r1=1.3.2.2.2.5&r2=1.3.2.2.2.6&diff_format=u
Index: php-src/ext/bz2/bz2_filter.c
diff -u php-src/ext/bz2/bz2_filter.c:1.3.2.2.2.5 
php-src/ext/bz2/bz2_filter.c:1.3.2.2.2.6
--- php-src/ext/bz2/bz2_filter.c:1.3.2.2.2.5Thu Aug  9 23:27:22 2007
+++ php-src/ext/bz2/bz2_filter.cSun Dec 16 17:22:31 2007
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: bz2_filter.c,v 1.3.2.2.2.5 2007/08/09 23:27:22 iliaa Exp $ */
+/* $Id: bz2_filter.c,v 1.3.2.2.2.6 2007/12/16 17:22:31 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -132,6 +132,8 @@
data->strm.avail_out = data->outbuf_len;
data->strm.next_out = data->outbuf;
exit_status = PSFS_PASS_ON;
+   } else if (status == BZ_OK) {
+   break;
}
}
}
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1034&r2=1.2027.2.547.2.1035&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1034 php-src/NEWS:1.2027.2.547.2.1035
--- php-src/NEWS:1.2027.2.547.2.1034Sun Dec 16 17:14:54 2007
+++ php-src/NEWSSun Dec 16 17:22:31 2007
@@ -3,8 +3,9 @@
 ?? ??? 2008, PHP 5.2.6
 - Fixed weired behavior in CGI parameter parsing. (Dmitry, Hannes Magnusson)
 
-- Fixed bug #43606 (define missing depencies of the exif extension)
+- Fixed bug #43606 (define missing depencies of the exif extension).
   (crrodriguez at suse dot de)
+- Fixed bug #43589 (a possible infinite loop in bz2_filter.c). (Greg)
 - Fixed bug #43580 (removed bogus declaration of a non-existent php_is_url()  
   function). (Ilia)
 - Fixed bug #43533 (escapeshellarg('') returns null). (Ilia)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/bz2 bz2_filter.c

2007-08-09 Thread Ilia Alshanetsky
iliaa   Thu Aug  9 23:27:22 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/bz2bz2_filter.c 
/php-srcNEWS 
  Log:
  
  Fixed bug #42117 (bzip2.compress loses data in internal buffer)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/bz2_filter.c?r1=1.3.2.2.2.4&r2=1.3.2.2.2.5&diff_format=u
Index: php-src/ext/bz2/bz2_filter.c
diff -u php-src/ext/bz2/bz2_filter.c:1.3.2.2.2.4 
php-src/ext/bz2/bz2_filter.c:1.3.2.2.2.5
--- php-src/ext/bz2/bz2_filter.c:1.3.2.2.2.4Thu Jan 25 12:22:21 2007
+++ php-src/ext/bz2/bz2_filter.cThu Aug  9 23:27:22 2007
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: bz2_filter.c,v 1.3.2.2.2.4 2007/01/25 12:22:21 tony2001 Exp $ */
+/* $Id: bz2_filter.c,v 1.3.2.2.2.5 2007/08/09 23:27:22 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -228,8 +228,8 @@
 
if (flags & PSFS_FLAG_FLUSH_CLOSE) {
/* Spit it out! */
-   status = BZ_OUTBUFF_FULL;
-   while (status == BZ_OUTBUFF_FULL) {
+   status = BZ_FINISH_OK;
+   while (status == BZ_FINISH_OK) {
status = BZ2_bzCompress(&(data->strm), BZ_FINISH);
if (data->strm.avail_out < data->outbuf_len) {
size_t bucketlen = data->outbuf_len - 
data->strm.avail_out;
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.888&r2=1.2027.2.547.2.889&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.888 php-src/NEWS:1.2027.2.547.2.889
--- php-src/NEWS:1.2027.2.547.2.888 Thu Aug  9 08:43:09 2007
+++ php-src/NEWSThu Aug  9 23:27:22 2007
@@ -13,6 +13,8 @@
 - Fixed bug #42198 (SCRIPT_NAME and PHP_SELF truncated when inside a userdir
   and using PATH_INFO). (Dmitry)
 - Fixed bug #42195 (C++ compiler required always). (Jani)
+- Fixed bug #42117 (bzip2.compress loses data in internal buffer). (Philip,
+  Ilia)
 - Fixed bug #42082 (NodeList length zero should be empty). (Hannes)
 - Fixed bug #41973 (./configure --with-ldap=shared fails with
   LDFLAGS="-Wl,--as-needed"). (Nuno)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/bz2 bz2_filter.c /ext/zlib zlib_filter.c

2007-01-25 Thread Antony Dovgal
tony2001Thu Jan 25 12:22:21 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-srcNEWS 
/php-src/ext/bz2bz2_filter.c 
/php-src/ext/zlib   zlib_filter.c 
  Log:
  MFH: fix #40189 (possible endless loop in zlib.inflate stream filter)
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.510&r2=1.2027.2.547.2.511&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.510 php-src/NEWS:1.2027.2.547.2.511
--- php-src/NEWS:1.2027.2.547.2.510 Tue Jan 23 18:14:52 2007
+++ php-src/NEWSThu Jan 25 12:22:21 2007
@@ -7,6 +7,8 @@
   thread safe version). (Dmitry)
 - Fixed bug #40191 (use of array_unique() with objects triggers segfault).
   (Tony)
+- Fixed bug #40189 (possible endless loop in zlib.inflate stream filter).
+  (Greg, Tony)
 - Fixed bug #40169 (CURLOPT_TCP_NODELAY only available in curl >= 7.11.2). 
   (Tony)
 - Fixed bug #40092 (chroot() doesn't clear realpath cache). (Dmitry)
http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/bz2_filter.c?r1=1.3.2.2.2.3&r2=1.3.2.2.2.4&diff_format=u
Index: php-src/ext/bz2/bz2_filter.c
diff -u php-src/ext/bz2/bz2_filter.c:1.3.2.2.2.3 
php-src/ext/bz2/bz2_filter.c:1.3.2.2.2.4
--- php-src/ext/bz2/bz2_filter.c:1.3.2.2.2.3Mon Jan  1 09:35:48 2007
+++ php-src/ext/bz2/bz2_filter.cThu Jan 25 12:22:21 2007
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: bz2_filter.c,v 1.3.2.2.2.3 2007/01/01 09:35:48 sebastian Exp $ */
+/* $Id: bz2_filter.c,v 1.3.2.2.2.4 2007/01/25 12:22:21 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -101,6 +101,11 @@
consumed += desired;
bin += desired;
 
+   if (!desired) {
+   flags |= PSFS_FLAG_FLUSH_CLOSE;
+   break;
+   }
+
if (data->strm.avail_out < data->outbuf_len) {
php_stream_bucket *out_bucket;
size_t bucketlen = data->outbuf_len - 
data->strm.avail_out;
http://cvs.php.net/viewvc.cgi/php-src/ext/zlib/zlib_filter.c?r1=1.6.2.2.2.3&r2=1.6.2.2.2.4&diff_format=u
Index: php-src/ext/zlib/zlib_filter.c
diff -u php-src/ext/zlib/zlib_filter.c:1.6.2.2.2.3 
php-src/ext/zlib/zlib_filter.c:1.6.2.2.2.4
--- php-src/ext/zlib/zlib_filter.c:1.6.2.2.2.3  Mon Jan  1 09:36:10 2007
+++ php-src/ext/zlib/zlib_filter.c  Thu Jan 25 12:22:21 2007
@@ -16,7 +16,7 @@
+--+
 */
 
-/* $Id: zlib_filter.c,v 1.6.2.2.2.3 2007/01/01 09:36:10 sebastian Exp $ */
+/* $Id: zlib_filter.c,v 1.6.2.2.2.4 2007/01/25 12:22:21 tony2001 Exp $ */
 
 #include "php.h"
 #include "php_zlib.h"
@@ -100,6 +100,11 @@
consumed += desired;
bin += desired;
 
+   if (!desired) {
+   flags |= PSFS_FLAG_FLUSH_CLOSE;
+   break;
+   }
+
if (data->strm.avail_out < data->outbuf_len) {
php_stream_bucket *out_bucket;
size_t bucketlen = data->outbuf_len - 
data->strm.avail_out;
@@ -208,6 +213,11 @@
consumed += desired;
bin += desired;
 
+   if (!desired) {
+   flags |= PSFS_FLAG_FLUSH_CLOSE;
+   break;
+   }
+
if (data->strm.avail_out < data->outbuf_len) {
php_stream_bucket *out_bucket;
size_t bucketlen = data->outbuf_len - 
data->strm.avail_out;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php