]> granicus.if.org Git - php/commitdiff
Re-Fixed bug #46026 (bz2.decompress/zlib.inflate filter tries to decompress after...
authorGreg Beaver <cellog@php.net>
Tue, 3 Feb 2009 18:56:26 +0000 (18:56 +0000)
committerGreg Beaver <cellog@php.net>
Tue, 3 Feb 2009 18:56:26 +0000 (18:56 +0000)
NEWS
ext/bz2/bz2_filter.c

diff --git a/NEWS b/NEWS
index f11320e65a6061e6b337c7d404649ca130cc4a2d..46373e61da32585fa43a2d881b2555ec296f5cbe 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,7 +6,8 @@ PHP                                                                        NEWS
 - Fixed bug #47085 (rename() returns true even if the file in PHAR does not exist). (Greg)
 - Fixed bug #47031 (Fix constants in DualIterator example). (Etienne)
 - Fixed bug #46347 (parse_ini_file() doesn't support * in keys). (Nuno)
-
+- Re-Fixed bug #46026 (bz2.decompress/zlib.inflate filter tries to decompress after
+  end of stream). (Greg)
 
 29 Jan 2009, PHP 5.3.0 Beta 1
 - Upgraded bundled sqlite to version 3.6.10. (Scott, Ilia)
index ecb57dfe151569f2f54ba4584619bead0e37aff1..3ec29e4d4bdacfa77e548277dad60c2e697d9a67 100644 (file)
@@ -353,11 +353,14 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
                        if (Z_TYPE_P(filterparams) == IS_ARRAY || Z_TYPE_P(filterparams) == IS_OBJECT) {
 
                                if (SUCCESS == zend_hash_find(HASH_OF(filterparams), "concatenated", sizeof("concatenated"), (void **) &tmpzval) ) {
-                                               SEPARATE_ZVAL(tmpzval);
-                                               convert_to_boolean_ex(tmpzval);
-                                               data->expect_concatenated = Z_LVAL_PP(tmpzval);
-                                               zval_ptr_dtor(tmpzval);
-                                               tmpzval = NULL;
+                                       zval tmp, *tmp2;
+
+                                       tmp = **tmpzval;
+                                       zval_copy_ctor(&tmp);
+                                       tmp2 = &tmp;
+                                       convert_to_boolean_ex(&tmp2);
+                                       data->expect_concatenated = Z_LVAL(tmp);
+                                       tmpzval = NULL;
                                }
 
                                zend_hash_find(HASH_OF(filterparams), "small", sizeof("small"), (void **) &tmpzval);
@@ -366,10 +369,13 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
                        }
 
                        if (tmpzval) {
-                               SEPARATE_ZVAL(tmpzval);
-                               convert_to_boolean_ex(tmpzval);
-                               data->small_footprint = Z_LVAL_PP(tmpzval);
-                               zval_ptr_dtor(tmpzval);
+                               zval tmp, *tmp2;
+
+                               tmp = **tmpzval;
+                               zval_copy_ctor(&tmp);
+                               tmp2 = &tmp;
+                               convert_to_boolean_ex(&tmp2);
+                               data->small_footprint = Z_LVAL(tmp);
                        }
                }
 
@@ -385,26 +391,31 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
                        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);
+                                               workFactor = Z_LVAL(tmp);
                                        }
-                                       zval_ptr_dtor(tmpzval);
                                }
                        }
                }