Skip to content

Commit

Permalink
Fix use after free with file cache and arena allocated strings
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Dec 1, 2020
1 parent 648cda6 commit 5dfec88
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,9 @@ void init_compiler(void) /* {{{ */

void shutdown_compiler(void) /* {{{ */
{
/* Reset filename before destroying the arena, as file cache may use arena allocated strings. */
zend_restore_compiled_filename(NULL);

zend_stack_destroy(&CG(loop_var_stack));
zend_stack_destroy(&CG(delayed_oplines_stack));
zend_stack_destroy(&CG(short_circuiting_opnums));
Expand All @@ -437,7 +440,6 @@ void shutdown_compiler(void) /* {{{ */
FREE_HASHTABLE(CG(delayed_autoloads));
CG(delayed_autoloads) = NULL;
}
zend_restore_compiled_filename(NULL);
}
/* }}} */

Expand Down

0 comments on commit 5dfec88

Please sign in to comment.