Skip to content

Commit ccff3d9

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: Fix func/class name use after free on opcache OOM condition
2 parents d9e5c6b + e7de9b2 commit ccff3d9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ext/opcache/zend_accelerator_util_funcs.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ zend_persistent_script* create_persistent_script(void)
4646
void free_persistent_script(zend_persistent_script *persistent_script, int destroy_elements)
4747
{
4848
if (!destroy_elements) {
49-
persistent_script->script.function_table.pDestructor = NULL;
50-
persistent_script->script.class_table.pDestructor = NULL;
49+
/* Both the keys and values have been transferred into the global tables.
50+
* Set nNumUsed=0 to only deallocate the table, but not destroy any elements. */
51+
persistent_script->script.function_table.nNumUsed = 0;
52+
persistent_script->script.class_table.nNumUsed = 0;
5153
} else {
5254
destroy_op_array(&persistent_script->script.main_op_array);
5355
}

0 commit comments

Comments
 (0)