Skip to content

Commit b0e16f0

Browse files
committed
Fix jump after zend_jit_invalid_property_assign()
This is supposed to go to the FREE_OP_DATA, currently it crashes.
1 parent 85b80c5 commit b0e16f0

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13620,7 +13620,7 @@ static int zend_jit_assign_obj_op(dasm_State **Dst,
1362013620
}
1362113621
if (((opline+1)->op1_type & (IS_VAR|IS_TMP_VAR))
1362213622
&& (val_info & (MAY_BE_REF|MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
13623-
| jmp >7
13623+
| jmp >8
1362413624
} else {
1362513625
| jmp ->exception_handler
1362613626
}
@@ -13952,7 +13952,7 @@ static int zend_jit_assign_obj(dasm_State **Dst,
1395213952
}
1395313953
if (((opline+1)->op1_type & (IS_VAR|IS_TMP_VAR))
1395413954
&& (val_info & (MAY_BE_REF|MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
13955-
| jmp >8
13955+
| jmp >7
1395613956
} else {
1395713957
| jmp ->exception_handler
1395813958
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
--TEST--
2+
JIT ASSIGN_OBJ: Assign property on null
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
--FILE--
9+
<?php
10+
function test1($o) {
11+
$o->x = new stdClass;
12+
}
13+
function test2($o) {
14+
$o->x += new stdClass;
15+
}
16+
17+
try {
18+
test1(null);
19+
} catch (Error $e) {
20+
echo $e->getMessage(), "\n";
21+
}
22+
23+
try {
24+
test2(null);
25+
} catch (Error $e) {
26+
echo $e->getMessage(), "\n";
27+
}
28+
29+
?>
30+
--EXPECT--
31+
Attempt to assign property "x" on null
32+
Attempt to assign property "x" on null

0 commit comments

Comments
 (0)