cvs: ZendEngine2(PHP_5_0) / zend_execute.c /tests bug32674.phpt php-src NEWS

From: Date: Wed, 27 Apr 2005 06:46:44 +0000
Subject: cvs: ZendEngine2(PHP_5_0) / zend_execute.c /tests bug32674.phpt php-src NEWS
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-3597@lists.php.net to get a copy of this message
dmitry Wed Apr 27 02:46:44 2005 EDT Added files: (Branch: PHP_5_0) /ZendEngine2/tests bug32674.phpt Modified files: /php-src NEWS /ZendEngine2 zend_execute.c Log: Fixed bug #32674 (exception in iterator causes crash) http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1760.2.350&r2=1.1760.2.351&ty=u Index: php-src/NEWS diff -u php-src/NEWS:1.1760.2.350 php-src/NEWS:1.1760.2.351 --- php-src/NEWS:1.1760.2.350 Tue Apr 26 09:23:06 2005 +++ php-src/NEWS Wed Apr 27 02:46:43 2005 @@ -23,6 +23,7 @@ (Marcus) - Fixed bug #32682 (ext/mssql: Error on module shutdown when called from activescript). (Frank) +- Fixed bug #32674 (exception in iterator causes crash). (Dmitry) - Fixed bug #32647 (Using register_shutdown_function() with invalid callback can crash PHP). (Jani) - Fixed bug #32615 (Segfault in replaceChild() using fragment when http://cvs.php.net/diff.php/ZendEngine2/zend_execute.c?r1=1.652.2.24&r2=1.652.2.25&ty=u Index: ZendEngine2/zend_execute.c diff -u ZendEngine2/zend_execute.c:1.652.2.24 ZendEngine2/zend_execute.c:1.652.2.25 --- ZendEngine2/zend_execute.c:1.652.2.24 Tue Apr 26 09:23:07 2005 +++ ZendEngine2/zend_execute.c Wed Apr 27 02:46:43 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute.c,v 1.652.2.24 2005/04/26 13:23:07 dmitry Exp $ */ +/* $Id: zend_execute.c,v 1.652.2.25 2005/04/27 06:46:43 dmitry Exp $ */ #define ZEND_INTENSIVE_DEBUGGING 0 @@ -1333,7 +1333,7 @@ #define SET_OPCODE(new_op) \ CHECK_SYMBOL_TABLES() \ - EX(opline) = new_op; + EX(opline) = new_op; \ #define INC_OPCODE() \ if (!EG(exception)) { \ @@ -3784,6 +3784,11 @@ iter->index = 0; if (iter->funcs->rewind) { iter->funcs->rewind(iter TSRMLS_CC); + if (EG(exception)) { + array_ptr->refcount--; + zval_ptr_dtor(&array_ptr); + NEXT_OPCODE(); + } } } else if ((fe_ht = HASH_OF(array_ptr)) != NULL) { /* probably redundant */ @@ -3860,13 +3865,28 @@ /* This could cause an endless loop if index becomes zero again. * In case that ever happens we need an additional flag. */ iter->funcs->move_forward(iter TSRMLS_CC); + if (EG(exception)) { + array->refcount--; + zval_ptr_dtor(&array); + NEXT_OPCODE(); + } } if (!iter || iter->funcs->valid(iter TSRMLS_CC) == FAILURE) { /* reached end of iteration */ + if (EG(exception)) { + array->refcount--; + zval_ptr_dtor(&array); + NEXT_OPCODE(); + } SET_OPCODE(op_array->opcodes+opline->op2.u.opline_num); return 0; /* CHECK_ME */ } iter->funcs->get_current_data(iter, &value TSRMLS_CC); + if (EG(exception)) { + array->refcount--; + zval_ptr_dtor(&array); + NEXT_OPCODE(); + } if (!value) { /* failure in get_current_data */ SET_OPCODE(op_array->opcodes+opline->op2.u.opline_num); @@ -3874,6 +3894,11 @@ } if (iter->funcs->get_current_key) { key_type = iter->funcs->get_current_key(iter, &str_key, &str_key_len, &int_key TSRMLS_CC); + if (EG(exception)) { + array->refcount--; + zval_ptr_dtor(&array); + NEXT_OPCODE(); + } } else { key_type = HASH_KEY_IS_LONG; int_key = iter->index; http://cvs.php.net/co.php/ZendEngine2/tests/bug32674.phpt?r=1.1&p=1 Index: ZendEngine2/tests/bug32674.phpt +++ ZendEngine2/tests/bug32674.phpt

« previous php.zend-engine.cvs (#3597) next »