Skip to content

Commit 3a8912f

Browse files
committed
Fix memory leak
This fixes oss-fuzz #47648
1 parent 591bd11 commit 3a8912f

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

ext/opcache/jit/zend_jit_x86.dasc

+1-1
Original file line numberDiff line numberDiff line change
@@ -6183,7 +6183,7 @@ static int zend_jit_assign_to_typed_ref(dasm_State **Dst,
61836183
| // if (UNEXPECTED(EG(exception) != NULL)) {
61846184
| MEM_OP2_1_ZTS cmp, aword, executor_globals, exception, 0, r0
61856185
| je >8 // END OF zend_jit_assign_to_variable()
6186-
| jmp ->exception_handler_undef
6186+
| jmp ->exception_handler
61876187
} else {
61886188
| jmp >8
61896189
}

ext/opcache/tests/jit/assign_053.phpt

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
JIT ASSIGN: memory leak
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
opcache.protect_memory=1
9+
--FILE--
10+
<?php
11+
class Test {
12+
public string $x;
13+
}
14+
$test=new Test;
15+
$test->x = " $y ";
16+
$r = &$test->x + ($r = $y);
17+
?>
18+
--EXPECTF--
19+
Warning: Undefined variable $y in %sassign_053.php on line 6
20+
21+
Warning: Undefined variable $y in %sassign_053.php on line 7
22+
23+
Fatal error: Uncaught TypeError: Cannot assign null to reference held by property Test::$x of type string in %sassign_053.php:7
24+
Stack trace:
25+
#0 {main}
26+
thrown in %sassign_053.php on line 7

0 commit comments

Comments
 (0)