cvs: php-src(PHP_5_1) /ext/spl spl_array.c

From: Date: Sun, 09 Oct 2005 14:42:10 +0000
Subject: cvs: php-src(PHP_5_1) /ext/spl spl_array.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-34438@lists.php.net to get a copy of this message
helly Sun Oct 9 10:42:10 2005 EDT Modified files: (Branch: PHP_5_1) /php-src/ext/spl spl_array.c Log: - MFH Fix potential SEGV with overloaded objects http://cvs.php.net/diff.php/php-src/ext/spl/spl_array.c?r1=1.71.2.4&r2=1.71.2.5&ty=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.71.2.4 php-src/ext/spl/spl_array.c:1.71.2.5 --- php-src/ext/spl/spl_array.c:1.71.2.4 Mon Oct 3 13:59:56 2005 +++ php-src/ext/spl/spl_array.c Sun Oct 9 10:42:08 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_array.c,v 1.71.2.4 2005/10/03 17:59:56 helly Exp $ */ +/* $Id: spl_array.c,v 1.71.2.5 2005/10/09 14:42:08 helly Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -825,6 +825,15 @@ } intern->ar_flags |= ar_flags; ZVAL_ADDREF(intern->array); + if (Z_TYPE_P(array) == IS_OBJECT) { + zend_object_get_properties_t handler = Z_OBJ_HANDLER_P(array, get_properties); + if ((handler != std_object_handlers.get_properties && handler != spl_array_get_properties) + || !spl_array_get_hash_table(intern, 0 TSRMLS_CC)) { + php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); + zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Overloaded object of type %s is not compatible with %s", Z_OBJCE_P(array)->name, intern->std.ce->name); + return; + } + } spl_array_rewind(intern TSRMLS_CC);

« previous php.cvs (#34438) next »