Skip to content

Commit b6e34ea

Browse files
committed
Fixed rarely possible use-after-free
1 parent c935b83 commit b6e34ea

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

ext/opcache/Optimizer/zend_optimizer.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,6 +1027,19 @@ int zend_optimize_script(zend_script *script, zend_long optimization_level, zend
10271027
ZEND_SET_FUNC_INFO(call_graph.op_arrays[i], NULL);
10281028
}
10291029

1030+
ZEND_HASH_FOREACH_PTR(&script->class_table, ce) {
1031+
ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->function_table, name, op_array) {
1032+
if (op_array->scope != ce) {
1033+
zend_op_array *orig_op_array;
1034+
if ((orig_op_array = zend_hash_find_ptr(&op_array->scope->function_table, name)) != NULL) {
1035+
HashTable *ht = op_array->static_variables;
1036+
*op_array = *orig_op_array;
1037+
op_array->static_variables = ht;
1038+
}
1039+
}
1040+
} ZEND_HASH_FOREACH_END();
1041+
} ZEND_HASH_FOREACH_END();
1042+
10301043
zend_arena_release(&ctx.arena, checkpoint);
10311044
} else
10321045
#endif

0 commit comments

Comments
 (0)