Skip to content

Commit 8ef6957

Browse files
committed
Fixed phpGH-12623: Segmentation fault in ZEND_DO_UCALL_SPEC_RETVAL_USED_HANDLER
1 parent c01fb83 commit 8ef6957

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ext/opcache/jit/zend_jit_ir.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4041,6 +4041,10 @@ static int zend_jit_tail_handler(zend_jit_ctx *jit, const zend_op *opline)
40414041
handler = opline->handler;
40424042
if (GCC_GLOBAL_REGS) {
40434043
ir_TAILCALL(IR_VOID, ir_CONST_FUNC(handler));
4044+
} else if (jit->ssa->cfg.flags & ZEND_FUNC_RECURSIVE_DIRECTLY) {
4045+
ref = jit_FP(jit);
4046+
ir_CALL_1(IR_I32, ir_CONST_FC_FUNC(handler), ref);
4047+
ir_RETURN(ir_CONST_I32(1));
40444048
} else {
40454049
ref = jit_FP(jit);
40464050
ir_TAILCALL_1(IR_I32, ir_CONST_FC_FUNC(handler), ref);
@@ -4071,7 +4075,7 @@ static int zend_jit_tail_handler(zend_jit_ctx *jit, const zend_op *opline)
40714075
jit->ssa->cfg.blocks[succ].flags |= ZEND_BB_ENTRY;
40724076
}
40734077
ref = jit->ctx.insns_count - 1;
4074-
ZEND_ASSERT(jit->ctx.ir_base[ref].op == IR_UNREACHABLE);
4078+
ZEND_ASSERT(jit->ctx.ir_base[ref].op == IR_UNREACHABLE || jit->ctx.ir_base[ref].op == IR_RETURN);
40754079
ref = zend_jit_continue_entry(jit, ref, jit->ssa->cfg.blocks[succ].start);
40764080
_zend_jit_add_predecessor_ref(jit, succ, jit->b, ref);
40774081
}

0 commit comments

Comments
 (0)