cvs: php-src /ext/spl spl_array.c
| From: | Marcus Boerger | Date: | Sun, 09 Oct 2005 09:55:32 +0000 |
| Subject: | cvs: php-src /ext/spl spl_array.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-34424@lists.php.net to get a copy of this message | ||
helly Sun Oct 9 05:55:32 2005 EDT
Modified files:
/php-src/ext/spl spl_array.c
Log:
- Fix potential SEGV with overloaded objects
http://cvs.php.net/diff.php/php-src/ext/spl/spl_array.c?r1=1.84&r2=1.85&ty=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.84 php-src/ext/spl/spl_array.c:1.85
--- php-src/ext/spl/spl_array.c:1.84 Mon Oct 3 13:58:44 2005
+++ php-src/ext/spl/spl_array.c Sun Oct 9 05:55:30 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_array.c,v 1.84 2005/10/03 17:58:44 helly Exp $ */
+/* $Id: spl_array.c,v 1.85 2005/10/09 09:55:30 helly Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -836,6 +836,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(U_CLASS_ENTRY(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);