]> granicus.if.org Git - php/commitdiff
Check for ZEND_HANDLE_EXCEPTION opcode before accessing opline trace info.
authorDmitry Stogov <dmitry@zend.com>
Mon, 25 May 2020 13:45:45 +0000 (16:45 +0300)
committerDmitry Stogov <dmitry@zend.com>
Mon, 25 May 2020 13:45:45 +0000 (16:45 +0300)
ext/opcache/jit/zend_jit_vm_helpers.c

index 9a8e069e1ba496c6c68ae9373571e63fc5de8d64..04eb311cd72bdafedbaa3fcee7e2d98b8552d807 100644 (file)
@@ -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) {