Skip to content

Commit 95e93b8

Browse files
committed
Fix faulty zend_try handling in zend_jit_trace()
1 parent af50736 commit 95e93b8

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ PHP NEWS
2323
zend_jit_use_reg). (Arnaud)
2424
. Fixed bug GH-21593 (Borked function JIT JMPNZ smart branch). (ilutov)
2525
. Fixed bug GH-21460 (COND optimization regression). (Dmitry, Arnaud)
26+
. Fixed faulty returns out of zend_try block in zend_jit_trace(). (ilutov)
2627

2728
- OpenSSL:
2829
. Fix a bunch of memory leaks and crashes on edge cases. (ndossche)

ext/opcache/jit/zend_jit_trace.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5167,7 +5167,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
51675167
&& ssa->vars[ssa_op->op2_def].use_chain < 0
51685168
&& !ssa->vars[ssa_op->op2_def].phi_use_chain) {
51695169
if (!zend_jit_store_type(&ctx, var_num, type)) {
5170-
return 0;
5170+
goto jit_failure;
51715171
}
51725172
SET_STACK_TYPE(stack, var_num, type, 1);
51735173
}
@@ -5220,7 +5220,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
52205220
&& ssa->vars[ssa_op->op1_def].use_chain < 0
52215221
&& !ssa->vars[ssa_op->op1_def].phi_use_chain) {
52225222
if (!zend_jit_store_type(&ctx, var_num, type)) {
5223-
return 0;
5223+
goto jit_failure;
52245224
}
52255225
SET_STACK_TYPE(stack, var_num, type, 1);
52265226
}
@@ -5317,7 +5317,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
53175317
&& ssa->vars[ssa_op->op1_def].use_chain < 0
53185318
&& !ssa->vars[ssa_op->op1_def].phi_use_chain) {
53195319
if (!zend_jit_store_type(&ctx, var_num, type)) {
5320-
return 0;
5320+
goto jit_failure;
53215321
}
53225322
SET_STACK_TYPE(stack, var_num, type, 1);
53235323
}
@@ -6539,7 +6539,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
65396539
var_num = EX_VAR_TO_NUM(var_num);
65406540

65416541
if (!zend_jit_store_type(&ctx, var_num, type)) {
6542-
return 0;
6542+
goto jit_failure;
65436543
}
65446544
SET_STACK_TYPE(stack, var_num, type, 1);
65456545
}
@@ -7179,7 +7179,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
71797179
&& type != STACK_MEM_TYPE(stack, i)
71807180
&& zend_jit_trace_must_store_type(op_array, op_array_ssa, opline - op_array->opcodes, i, type)) {
71817181
if (!zend_jit_store_type(jit, i, type)) {
7182-
return 0;
7182+
goto jit_failure;
71837183
}
71847184
SET_STACK_TYPE(stack, i, type, 1);
71857185
}
@@ -7301,11 +7301,11 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
73017301
zend_string_release(name);
73027302
}
73037303

7304+
jit_cleanup:;
73047305
} zend_catch {
73057306
do_bailout = 1;
73067307
} zend_end_try();
73077308

7308-
jit_cleanup:
73097309
/* Clean up used op_arrays */
73107310
while (num_op_arrays > 0) {
73117311
op_array = op_arrays[--num_op_arrays];

0 commit comments

Comments
 (0)