From: Dmitry Stogov Date: Mon, 25 May 2020 13:45:45 +0000 (+0300) Subject: Check for ZEND_HANDLE_EXCEPTION opcode before accessing opline trace info. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3376f19742cc68448a26404df98f709f5255a262;p=php Check for ZEND_HANDLE_EXCEPTION opcode before accessing opline trace info. --- diff --git a/ext/opcache/jit/zend_jit_vm_helpers.c b/ext/opcache/jit/zend_jit_vm_helpers.c index 9a8e069e1b..04eb311cd7 100644 --- a/ext/opcache/jit/zend_jit_vm_helpers.c +++ b/ext/opcache/jit/zend_jit_vm_helpers.c @@ -538,6 +538,11 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex, #endif zend_execute_data *prev_call = EX(call); + if (UNEXPECTED(opline->opcode == ZEND_HANDLE_EXCEPTION)) { + /* Abort trace because of exception */ + return ZEND_JIT_TRACE_STOP_EXCEPTION; + } + orig_opline = opline; jit_extension = @@ -552,12 +557,6 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex, } while (1) { - if (UNEXPECTED(opline->opcode == ZEND_HANDLE_EXCEPTION)) { - /* Abort trace because of exception */ - stop = ZEND_JIT_TRACE_STOP_EXCEPTION; - break; - } - ce1 = ce2 = NULL; op1_type = op2_type = op3_type = IS_UNKNOWN; if ((opline->op1_type & (IS_TMP_VAR|IS_VAR|IS_CV)) @@ -785,6 +784,12 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex, opline = EX(opline); #endif + if (UNEXPECTED(opline->opcode == ZEND_HANDLE_EXCEPTION)) { + /* Abort trace because of exception */ + stop = ZEND_JIT_TRACE_STOP_EXCEPTION; + break; + } + trace_flags = ZEND_OP_TRACE_INFO(opline, offset)->trace_flags; if (trace_flags) { if (trace_flags & ZEND_JIT_TRACE_JITED) {