Skip to content

Commit d2a5c98

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Fix GH-15658: Segmentation fault in Zend/zend_vm_execute.h
2 parents 75f5cbf + c1ffd4b commit d2a5c98

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ PHP NEWS
3535
- Opcache:
3636
. Fixed bug GH-15661 (Access null pointer in
3737
Zend/Optimizer/zend_inference.c). (nielsdos)
38+
. Fixed bug GH-15658 (Segmentation fault in Zend/zend_vm_execute.h).
39+
(nielsdos)
3840

3941
- Standard:
4042
. Fixed bug GH-15552 (Signed integer overflow in ext/standard/scanf.c). (cmb)

ext/opcache/jit/zend_jit.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3992,7 +3992,13 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op
39923992
case ZEND_OP_DATA:
39933993
case ZEND_SWITCH_LONG:
39943994
case ZEND_SWITCH_STRING:
3995+
break;
39953996
case ZEND_MATCH:
3997+
/* We have to exit to the VM because the MATCH handler performs an N-way jump for
3998+
* which we can't generate simple (opcache.jit=1201) JIT code. */
3999+
if (!zend_jit_tail_handler(&dasm_state, opline)) {
4000+
goto jit_failure;
4001+
}
39964002
break;
39974003
case ZEND_JMP:
39984004
if (JIT_G(opt_level) < ZEND_JIT_LEVEL_INLINE) {

ext/opcache/tests/jit/gh15658.phpt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
GH-15658 (Segmentation fault in Zend/zend_vm_execute.h)
3+
--EXTENSIONS--
4+
opcache
5+
--INI--
6+
opcache.jit=0101
7+
opcache.jit_buffer_size=1024M
8+
--FILE--
9+
<?php
10+
echo match (random_int(1, 2)) {
11+
1, 2 => 'foo',
12+
};
13+
?>
14+
--EXPECT--
15+
foo

0 commit comments

Comments
 (0)