Skip to content

Commit

Permalink
Keeping consistent arg_stack during arguments freeing (Exception from…
Browse files Browse the repository at this point in the history
… destructor may use inconsistent arg_stack for backtrace).
  • Loading branch information
dstogov committed May 31, 2006
1 parent 75fac72 commit 4e66247
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 7 additions & 3 deletions Zend/zend_builtin_functions.c
Expand Up @@ -1708,9 +1708,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 */
Expand Down
4 changes: 3 additions & 1 deletion Zend/zend_execute.h
Expand Up @@ -152,7 +152,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;
}
Expand Down

0 comments on commit 4e66247

Please sign in to comment.