iliaa           Sun Mar  1 17:35:26 2009 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src    NEWS 
    /php-src/ext/zip    php_zip.c 
  Log:
  MFB: Fixed 2 memory corruptions in zip extension idenfied by 
  oo_properties.phpt test
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1430&r2=1.2027.2.547.2.1431&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1430 php-src/NEWS:1.2027.2.547.2.1431
--- php-src/NEWS:1.2027.2.547.2.1430    Wed Feb 25 15:34:33 2009
+++ php-src/NEWS        Sun Mar  1 17:35:25 2009
@@ -1,6 +1,7 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2009, PHP 5.2.10
+- Fixed memory corruptions while reading properties of zip files. (Ilia)
 
 26 Feb 2009, PHP 5.2.9
 - Changed __call() to be invoked on private/protected method access, similar to
http://cvs.php.net/viewvc.cgi/php-src/ext/zip/php_zip.c?r1=1.1.2.49&r2=1.1.2.50&diff_format=u
Index: php-src/ext/zip/php_zip.c
diff -u php-src/ext/zip/php_zip.c:1.1.2.49 php-src/ext/zip/php_zip.c:1.1.2.50
--- php-src/ext/zip/php_zip.c:1.1.2.49  Thu Feb  5 19:53:22 2009
+++ php-src/ext/zip/php_zip.c   Sun Mar  1 17:35:25 2009
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: php_zip.c,v 1.1.2.49 2009/02/05 19:53:22 pajoye Exp $ */
+/* $Id: php_zip.c,v 1.1.2.50 2009/03/01 17:35:25 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -806,6 +806,7 @@
                        } else {
                                if (hnd->read_const_char_from_obj_func) {
                                        retchar = 
hnd->read_const_char_from_obj_func(obj TSRMLS_CC);
+                                       len = strlen(retchar);
                                }
                        }
                }
@@ -818,7 +819,7 @@
        switch (hnd->type) {
                case IS_STRING:
                        if (retchar) {
-                               ZVAL_STRING(*retval, (char *) retchar, 1);
+                               ZVAL_STRINGL(*retval, (char *) retchar, len, 1);
                        } else {
                                ZVAL_EMPTY_STRING(*retval);
                        }
@@ -941,10 +942,11 @@
 
        if (ret == SUCCESS) {
                zval *tmp;
+               ALLOC_INIT_ZVAL(tmp);
 
                if (type == 2) {
                        retval = 1;
-               } else if (php_zip_property_reader(obj, hnd, &tmp, 1 TSRMLS_CC) 
== SUCCESS) {
+               } else if (php_zip_property_reader(obj, hnd, &tmp, 0 TSRMLS_CC) 
== SUCCESS) {
                        Z_SET_REFCOUNT_P(tmp, 1);
                        Z_UNSET_ISREF_P(tmp);
                        if (type == 1) {
@@ -952,8 +954,9 @@
                        } else if (type == 0) {
                                retval = (Z_TYPE_P(tmp) != IS_NULL);
                        }
-                       zval_ptr_dtor(&tmp);
                }
+
+               zval_ptr_dtor(&tmp);
        } else {
                std_hnd = zend_get_std_object_handlers();
                retval = std_hnd->has_property(object, member, type TSRMLS_CC);
@@ -2557,7 +2560,7 @@
        php_info_print_table_start();
 
        php_info_print_table_row(2, "Zip", "enabled");
-       php_info_print_table_row(2, "Extension Version","$Id: php_zip.c,v 
1.1.2.49 2009/02/05 19:53:22 pajoye Exp $");
+       php_info_print_table_row(2, "Extension Version","$Id: php_zip.c,v 
1.1.2.50 2009/03/01 17:35:25 iliaa Exp $");
        php_info_print_table_row(2, "Zip version", PHP_ZIP_VERSION_STRING);
        php_info_print_table_row(2, "Libzip version", "0.9.0");
 



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

Reply via email to