Skip to content

Commit 5dfec88

Browse files
committed
Fix use after free with file cache and arena allocated strings
1 parent 648cda6 commit 5dfec88

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Zend/zend_compile.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,9 @@ void init_compiler(void) /* {{{ */
422422

423423
void shutdown_compiler(void) /* {{{ */
424424
{
425+
/* Reset filename before destroying the arena, as file cache may use arena allocated strings. */
426+
zend_restore_compiled_filename(NULL);
427+
425428
zend_stack_destroy(&CG(loop_var_stack));
426429
zend_stack_destroy(&CG(delayed_oplines_stack));
427430
zend_stack_destroy(&CG(short_circuiting_opnums));
@@ -437,7 +440,6 @@ void shutdown_compiler(void) /* {{{ */
437440
FREE_HASHTABLE(CG(delayed_autoloads));
438441
CG(delayed_autoloads) = NULL;
439442
}
440-
zend_restore_compiled_filename(NULL);
441443
}
442444
/* }}} */
443445

0 commit comments

Comments
 (0)