From f6fc0fd97b9dc0138f28df6d4dbf361f8efafb07 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Wed, 25 Jan 2023 12:10:19 +0300 Subject: [PATCH] Add missing type guard --- ext/opcache/jit/zend_jit_trace.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ext/opcache/jit/zend_jit_trace.c b/ext/opcache/jit/zend_jit_trace.c index 6ac93fe95bb..2fc623a6c9a 100644 --- a/ext/opcache/jit/zend_jit_trace.c +++ b/ext/opcache/jit/zend_jit_trace.c @@ -6557,6 +6557,16 @@ done: for (i = 0; i < op_array->last_var; i++,j++) { if (ra[j] && (ra[j]->flags & ZREG_LOAD) != 0) { + if ((ssa->var_info[j].type & MAY_BE_GUARD) != 0) { + uint8_t op_type; + + ssa->var_info[j].type &= ~MAY_BE_GUARD; + op_type = concrete_type(ssa->var_info[j].type); + if (!zend_jit_type_guard(&dasm_state, opline, EX_NUM_TO_VAR(i), op_type)) { + goto jit_failure; + } + SET_STACK_TYPE(stack, i, op_type, 1); + } SET_STACK_REG_EX(stack, i, ra[j]->reg, ZREG_LOAD); if (!zend_jit_load_var(&dasm_state, ssa->var_info[j].type, i, ra[j]->reg)) { goto jit_failure;