Skip to content

Commit 133afe8

Browse files
committed
Fix JIT call chain check without call opcode
The do_fcall opcode may have been optimized away if an opcode like exit is present in the arguments. In that case the opcode scan would go past the end of the op array.
1 parent a8f0634 commit 133afe8

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

ext/opcache/jit/zend_jit.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,8 @@ static int zend_jit_needs_call_chain(zend_call_info *call_info, uint32_t b, cons
435435
} else {
436436
const zend_op *end = call_info->caller_call_opline;
437437

438-
if (end - op_array->opcodes >= ssa->cfg.blocks[b].start + ssa->cfg.blocks[b].len) {
438+
/* end may be null if an opcode like EXIT is part of the argument list. */
439+
if (!end || end - op_array->opcodes >= ssa->cfg.blocks[b].start + ssa->cfg.blocks[b].len) {
439440
/* INIT_FCALL and DO_FCALL in different BasicBlocks */
440441
return 1;
441442
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
Exit in argument list
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+
var_dump(exit);
11+
?>
12+
--EXPECT--

0 commit comments

Comments
 (0)