Permalink
Browse files

Keeping consistent arg_stack during arguments freeing (Exception from…

… destructor may use inconsistent arg_stack for backtrace).
  • Loading branch information...
1 parent 51e52e2 commit 8df40bdb313d84bf606ce0052954b8031bc5a91f Dmitry Stogov committed May 31, 2006
Showing with 10 additions and 4 deletions.
  1. +7 −3 Zend/zend_builtin_functions.c
  2. +3 −1 Zend/zend_execute.h
View
10 Zend/zend_builtin_functions.c
@@ -1628,9 +1628,13 @@ static zval *debug_backtrace_get_args(void ***curpos TSRMLS_DC)
while (--arg_count >= 0) {
arg = (zval **) p++;
- SEPARATE_ZVAL_TO_MAKE_IS_REF(arg);
- (*arg)->refcount++;
- add_next_index_zval(arg_array, *arg);
+ if (*arg) {
+ SEPARATE_ZVAL_TO_MAKE_IS_REF(arg);
+ (*arg)->refcount++;
+ add_next_index_zval(arg_array, *arg);
+ } else {
+ add_next_index_null(arg_array);
+ }
}
/* skip args from incomplete frames */
View
4 Zend/zend_execute.h
@@ -136,7 +136,9 @@ static inline void zend_ptr_stack_clear_multiple(TSRMLS_D)
EG(argument_stack).top -= (delete_count+2);
while (--delete_count>=0) {
- zval_ptr_dtor((zval **) --p);
+ zval *q = *(zval **)(--p);
+ *p = NULL;
+ zval_ptr_dtor(&q);
}
EG(argument_stack).top_element = p;
}

0 comments on commit 8df40bd

Please sign in to comment.