Skip to content

Commit 3376f19

Browse files
committed
Check for ZEND_HANDLE_EXCEPTION opcode before accessing opline trace info.
1 parent 201491e commit 3376f19

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

ext/opcache/jit/zend_jit_vm_helpers.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,11 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex,
538538
#endif
539539
zend_execute_data *prev_call = EX(call);
540540

541+
if (UNEXPECTED(opline->opcode == ZEND_HANDLE_EXCEPTION)) {
542+
/* Abort trace because of exception */
543+
return ZEND_JIT_TRACE_STOP_EXCEPTION;
544+
}
545+
541546
orig_opline = opline;
542547

543548
jit_extension =
@@ -552,12 +557,6 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex,
552557
}
553558

554559
while (1) {
555-
if (UNEXPECTED(opline->opcode == ZEND_HANDLE_EXCEPTION)) {
556-
/* Abort trace because of exception */
557-
stop = ZEND_JIT_TRACE_STOP_EXCEPTION;
558-
break;
559-
}
560-
561560
ce1 = ce2 = NULL;
562561
op1_type = op2_type = op3_type = IS_UNKNOWN;
563562
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,
785784
opline = EX(opline);
786785
#endif
787786

787+
if (UNEXPECTED(opline->opcode == ZEND_HANDLE_EXCEPTION)) {
788+
/* Abort trace because of exception */
789+
stop = ZEND_JIT_TRACE_STOP_EXCEPTION;
790+
break;
791+
}
792+
788793
trace_flags = ZEND_OP_TRACE_INFO(opline, offset)->trace_flags;
789794
if (trace_flags) {
790795
if (trace_flags & ZEND_JIT_TRACE_JITED) {

0 commit comments

Comments
 (0)