Skip to content

Commit b9a64c5

Browse files
committed
Fix GH-16358: Segmentation fault (access null pointer) in Zend/zend_operators.c:2495
1 parent 23c60d6 commit b9a64c5

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

ext/opcache/jit/zend_jit_ir.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9108,6 +9108,7 @@ static int zend_jit_init_static_method_call(zend_jit_ctx *jit,
91089108
if (fn->common.scope == op_array->scope
91099109
|| (fn->common.fn_flags & ZEND_ACC_PUBLIC)
91109110
|| ((fn->common.fn_flags & ZEND_ACC_PROTECTED)
9111+
&& op_array->scope
91119112
&& instanceof_function_slow(op_array->scope, fn->common.scope))) {
91129113
func = fn;
91139114
}
@@ -15823,6 +15824,7 @@ static int zend_jit_fetch_static_prop(zend_jit_ctx *jit, const zend_op *opline,
1582315824
if (prop_info->ce == op_array->scope
1582415825
|| (prop_info->flags & ZEND_ACC_PUBLIC)
1582515826
|| ((prop_info->flags & ZEND_ACC_PROTECTED)
15827+
&& op_array->scope
1582615828
&& instanceof_function_slow(op_array->scope, prop_info->ce))) {
1582715829
known_prop_info = prop_info;
1582815830
}

ext/opcache/tests/jit/gh16358.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
GH-16358 (Segmentation fault (access null pointer) in Zend/zend_operators.c:2495)
3+
--EXTENSIONS--
4+
opcache
5+
--INI--
6+
opcache.jit=1214
7+
opcache.jit_buffer_size=64M
8+
--FILE--
9+
<?php
10+
class test_class {
11+
static protected function test_func4() {
12+
}
13+
}
14+
if (is_callable(array('test_class','test_func4'))) {
15+
test_class::test_func4();
16+
}
17+
?>
18+
OK
19+
--EXPECT--
20+
OK

0 commit comments

Comments
 (0)