com php-src: Safe destruction (variables and arguments may need to be cuptured by exception): Zend/zend_execute.c Zend/zend_e xecute.h

From: Date: Thu, 16 Apr 2015 18:45:40 +0000
Subject: com php-src: Safe destruction (variables and arguments may need to be cuptured by exception): Zend/zend_execute.c Zend/zend_e xecute.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-86339@lists.php.net to get a copy of this message
Commit: 5b0d86edccb669b06bcf9f225a981f16c03da71a Author: Dmitry Stogov <dmitry@zend.com> Thu, 16 Apr 2015 21:45:40 +0300 Parents: e44ccde39a17cd316f3ab7fbf142d8d72546df68 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5b0d86edccb669b06bcf9f225a981f16c03da71a Log: Safe destruction (variables and arguments may need to be cuptured by exception) Changed paths: M Zend/zend_execute.c M Zend/zend_execute.h Diff: diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 04c33f8..a0bd3bd 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1806,7 +1806,15 @@ static zend_always_inline void i_free_compiled_variables(zend_execute_data *exec zval *cv = EX_VAR_NUM(0); zval *end = cv + EX(func)->op_array.last_var; while (EXPECTED(cv != end)) { - zval_ptr_dtor(cv); + if (Z_REFCOUNTED_P(cv)) { + if (!Z_DELREF_P(cv)) { + zend_refcounted *r = Z_COUNTED_P(cv); + ZVAL_NULL(cv); + zval_dtor_func_for_ptr(r); + } else { + GC_ZVAL_CHECK_POSSIBLE_ROOT(cv); + } + } cv++; } } diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 4dfed18..67958cf 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -199,7 +199,15 @@ static zend_always_inline void zend_vm_stack_free_extra_args_ex(uint32_t call_in zval *p = end + (ZEND_CALL_NUM_ARGS(call) - call->func->op_array.num_args); do { p--; - i_zval_ptr_dtor(p ZEND_FILE_LINE_CC); + if (Z_REFCOUNTED_P(p)) { + if (!Z_DELREF_P(p)) { + zend_refcounted *r = Z_COUNTED_P(p); + ZVAL_NULL(p); + zval_dtor_func_for_ptr(r); + } else { + GC_ZVAL_CHECK_POSSIBLE_ROOT(p); + } + } } while (p != end); } } @@ -219,7 +227,13 @@ static zend_always_inline void zend_vm_stack_free_args(zend_execute_data *call) do { p--; - zval_ptr_dtor_nogc(p); + if (Z_REFCOUNTED_P(p)) { + if (!Z_DELREF_P(p)) { + zend_refcounted *r = Z_COUNTED_P(p); + ZVAL_NULL(p); + zval_dtor_func_for_ptr(r); + } + } } while (p != end); } }

« previous php.cvs (#86339) next »