Skip to content

Fix GH-15658: Segmentation fault in Zend/zend_vm_execute.h #15782

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ext/opcache/jit/zend_jit.c
Original file line number Diff line number Diff line change
Expand Up @@ -3970,7 +3970,13 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op
case ZEND_OP_DATA:
case ZEND_SWITCH_LONG:
case ZEND_SWITCH_STRING:
break;
case ZEND_MATCH:
/* We have to exit to the VM because the MATCH handler performs an N-way jump for
* which we can't generate simple (opcache.jit=1201) JIT code. */
if (!zend_jit_tail_handler(&dasm_state, opline)) {
goto jit_failure;
}
break;
case ZEND_JMP:
if (JIT_G(opt_level) < ZEND_JIT_LEVEL_INLINE) {
Expand Down
15 changes: 15 additions & 0 deletions ext/opcache/tests/jit/gh15658.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--TEST--
GH-15658 (Segmentation fault in Zend/zend_vm_execute.h)
--EXTENSIONS--
opcache
--INI--
opcache.jit=0101
opcache.jit_buffer_size=1024M
--FILE--
<?php
echo match (random_int(1, 2)) {
1, 2 => 'foo',
};
?>
--EXPECT--
foo
Loading