RE: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_vm_def.h zend_vm_execute.h /tests bug30725.phpt

From: Date: Tue, 25 Jan 2005 06:42:48 +0000
Subject: RE: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_vm_def.h zend_vm_execute.h /tests bug30725.phpt
References: 1  Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-3335@lists.php.net to get a copy of this message
Hi Marcus, You should use if (opline->extended_value) { FREE_OP1_VAR_PTR(); } else { FREE_OP1_IF_VAR(); } instead of if (free_op1.var) {zval_ptr_dtor(&free_op1.var);}; free_op1.var is not set in case then op1.op_type == IS_CONST (it shouldn't be set if op1.op_type == IS_CV too), so your code is dangerous. Thanks. Dmitry. > -----Original Message----- > From: Marcus Boerger [mailto:helly@php.net] > Sent: Monday, January 24, 2005 23:03 > To: zend-engine-cvs@lists.php.net > Subject: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_vm_def.h > zend_vm_execute.h /tests bug30725.phpt > > > helly Mon Jan 24 15:02:56 2005 EDT > > Modified files: > /ZendEngine2 zend_vm_def.h zend_vm_execute.h > /ZendEngine2/tests bug30725.phpt > Log: > - Second and last part of #30725 fix > > > > http://cvs.php.net/diff.php/ZendEngine2/zend_vm_def.h?r1=1.9&r > 2=1.10&ty=u > Index: ZendEngine2/zend_vm_def.h > diff -u ZendEngine2/zend_vm_def.h:1.9 ZendEngine2/zend_vm_def.h:1.10 > --- ZendEngine2/zend_vm_def.h:1.9 Fri Jan 14 04:01:21 2005 > +++ ZendEngine2/zend_vm_def.h Mon Jan 24 15:02:51 2005 > @@ -16,7 +16,7 @@ > > +------------------------------------------------------------- > ---------+ > */ > > -/* $Id: zend_vm_def.h,v 1.9 2005/01/14 09:01:21 dmitry Exp $ */ > +/* $Id: zend_vm_def.h,v 1.10 2005/01/24 20:02:51 helly Exp $ */ > > ZEND_VM_HANDLER(1, ZEND_ADD, CONST|TMP|VAR|CV, > CONST|TMP|VAR|CV) { @@ -2863,10 +2863,13 @@ > if (ce && ce->get_iterator) { > iter = ce->get_iterator(ce, array_ptr TSRMLS_CC); > > - if (iter) { > + if (iter && !EG(exception)) { > array_ptr = zend_iterator_wrap(iter TSRMLS_CC); > } else { > - array_ptr->refcount++; > + zval_ptr_dtor(&array_ptr); > + if (free_op1.var) > {zval_ptr_dtor(&free_op1.var);}; > + zend_throw_exception_internal(NULL TSRMLS_CC); > + ZEND_VM_NEXT_OPCODE(); > } > } > > http://cvs.php.net/diff.php/ZendEngine2/zend_vm_execute.h?r1=1 > .11&r2=1.12&ty=u > Index: ZendEngine2/zend_vm_execute.h > diff -u ZendEngine2/zend_vm_execute.h:1.11 > ZendEngine2/zend_vm_execute.h:1.12 > --- ZendEngine2/zend_vm_execute.h:1.11 Fri Jan 14 04:01:22 2005 > +++ ZendEngine2/zend_vm_execute.h Mon Jan 24 15:02:52 2005 > @@ -16,7 +16,7 @@ > > +------------------------------------------------------------- > ---------+ > */ > > -/* $Id: zend_vm_execute.h,v 1.11 2005/01/14 09:01:22 dmitry Exp $ */ > +/* $Id: zend_vm_execute.h,v 1.12 2005/01/24 20:02:52 helly Exp $ */ > > > #define ZEND_VM_CONTINUE() return 0 > @@ -1959,10 +1959,13 @@ > if (ce && ce->get_iterator) { > iter = ce->get_iterator(ce, array_ptr TSRMLS_CC); > > - if (iter) { > + if (iter && !EG(exception)) { > array_ptr = zend_iterator_wrap(iter TSRMLS_CC); > } else { > - array_ptr->refcount++; > + zval_ptr_dtor(&array_ptr); > + if (free_op1.var) > {zval_ptr_dtor(&free_op1.var);}; > + zend_throw_exception_internal(NULL TSRMLS_CC); > + ZEND_VM_NEXT_OPCODE(); > } > } > > @@ -4368,10 +4371,13 @@ > if (ce && ce->get_iterator) { > iter = ce->get_iterator(ce, array_ptr TSRMLS_CC); > > - if (iter) { > + if (iter && !EG(exception)) { > array_ptr = zend_iterator_wrap(iter TSRMLS_CC); > } else { > - array_ptr->refcount++; > + zval_ptr_dtor(&array_ptr); > + if (free_op1.var) > {zval_ptr_dtor(&free_op1.var);}; > + zend_throw_exception_internal(NULL TSRMLS_CC); > + ZEND_VM_NEXT_OPCODE(); > } > } > > @@ -7439,10 +7445,13 @@ > if (ce && ce->get_iterator) { > iter = ce->get_iterator(ce, array_ptr TSRMLS_CC); > > - if (iter) { > + if (iter && !EG(exception)) { > array_ptr = zend_iterator_wrap(iter TSRMLS_CC); > } else { > - array_ptr->refcount++; > + zval_ptr_dtor(&array_ptr); > + if (free_op1.var) > {zval_ptr_dtor(&free_op1.var);}; > + zend_throw_exception_internal(NULL TSRMLS_CC); > + ZEND_VM_NEXT_OPCODE(); > } > } > > @@ -18208,10 +18217,13 @@ > if (ce && ce->get_iterator) { > iter = ce->get_iterator(ce, array_ptr TSRMLS_CC); > > - if (iter) { > + if (iter && !EG(exception)) { > array_ptr = zend_iterator_wrap(iter TSRMLS_CC); > } else { > - array_ptr->refcount++; > + zval_ptr_dtor(&array_ptr); > + if (free_op1.var) > {zval_ptr_dtor(&free_op1.var);}; > + zend_throw_exception_internal(NULL TSRMLS_CC); > + ZEND_VM_NEXT_OPCODE(); > } > } > > @@ -30500,10 +30512,13 @@ > if (ce && ce->get_iterator) { > iter = ce->get_iterator(ce, array_ptr TSRMLS_CC); > > - if (iter) { > + if (iter && !EG(exception)) { > array_ptr = zend_iterator_wrap(iter TSRMLS_CC); > } else { > - array_ptr->refcount++; > + zval_ptr_dtor(&array_ptr); > + if (free_op1.var) > {zval_ptr_dtor(&free_op1.var);}; > + zend_throw_exception_internal(NULL TSRMLS_CC); > + ZEND_VM_NEXT_OPCODE(); > } > } > > http://cvs.php.net/diff.php/ZendEngine2/tests/bug30725.phpt?r1 =1.1&r2=1.2&ty=u Index: ZendEngine2/tests/bug30725.phpt diff -u ZendEngine2/tests/bug30725.phpt:1.1 ZendEngine2/tests/bug30725.phpt:1.2 --- ZendEngine2/tests/bug30725.phpt:1.1 Mon Jan 24 14:16:06 2005 +++ ZendEngine2/tests/bug30725.phpt Mon Jan 24 15:02:55 2005 @@ -27,6 +27,6 @@ ?> ===DONE=== ----EXPECT--- +--EXPECT-- Caught ===DONE=== -- Zend Engine CVS Mailing List (http://cvs.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

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