tony2001 Fri Apr 7 22:53:23 2006 UTC Modified files: (Branch: PHP_5_1) /php-src/ext/spl spl_array.c Log: fix memory corruptions and leaks when cloning ArrayObjects and ArrayIterators http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.16&r2=1.71.2.17&diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.71.2.16 php-src/ext/spl/spl_array.c:1.71.2.17 --- php-src/ext/spl/spl_array.c:1.71.2.16 Tue Apr 4 19:53:21 2006 +++ php-src/ext/spl/spl_array.c Fri Apr 7 22:53:23 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_array.c,v 1.71.2.16 2006/04/04 19:53:21 helly Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17 2006/04/07 22:53:23 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -144,10 +144,12 @@ if (clone_orig) { intern->array = other->array; if (Z_OBJ_HT_P(orig) == &spl_handler_ArrayObject) { - ZVAL_ADDREF(intern->array); - SEPARATE_ZVAL(&intern->array); + MAKE_STD_ZVAL(intern->array); + array_init(intern->array); + zend_hash_copy(HASH_OF(intern->array), HASH_OF(other->array), (copy_ctor_func_t) zval_add_ref, &tmp, sizeof(zval*)); + } + if (Z_OBJ_HT_P(orig) == &spl_handler_ArrayIterator) { ZVAL_ADDREF(other->array); - ZVAL_ADDREF(intern->array); } } else { intern->array = orig;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php