Skip to content

Commit d955415

Browse files
committed
JIT: Fix named arguments handling
Fixes oss-fuzz #41486
1 parent 8f4cfe0 commit d955415

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

ext/opcache/jit/zend_jit.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2392,6 +2392,7 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op
23922392
&& (i + 1) <= end
23932393
&& (opline+1)->opcode == ZEND_SEND_VAL
23942394
&& (opline+1)->op1_type == IS_TMP_VAR
2395+
&& (opline+1)->op2_type != IS_CONST
23952396
&& (opline+1)->op1.var == opline->result.var) {
23962397
i++;
23972398
res_use_info = -1;
@@ -2446,6 +2447,7 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op
24462447
&& (i + 1) <= end
24472448
&& (opline+1)->opcode == ZEND_SEND_VAL
24482449
&& (opline+1)->op1_type == IS_TMP_VAR
2450+
&& (opline+1)->op2_type != IS_CONST
24492451
&& (opline+1)->op1.var == opline->result.var) {
24502452
i++;
24512453
res_use_info = -1;
@@ -2504,6 +2506,7 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op
25042506
&& (i + 1) <= end
25052507
&& (opline+1)->opcode == ZEND_SEND_VAL
25062508
&& (opline+1)->op1_type == IS_TMP_VAR
2509+
&& (opline+1)->op2_type != IS_CONST
25072510
&& (opline+1)->op1.var == opline->result.var) {
25082511
i++;
25092512
res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_RX, (opline+1)->result.var);
@@ -2727,6 +2730,7 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op
27272730
&& (i + 1) <= end
27282731
&& (opline+1)->opcode == ZEND_SEND_VAL
27292732
&& (opline+1)->op1_type == IS_TMP_VAR
2733+
&& (opline+1)->op2_type != IS_CONST
27302734
&& (opline+1)->op1.var == opline->result.var
27312735
&& (!(op1_info & MAY_HAVE_DTOR) || !(op1_info & MAY_BE_RC1))) {
27322736
i++;

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15520,10 +15520,11 @@ static zend_bool zend_jit_opline_supports_reg(const zend_op_array *op_array, zen
1552015520
uint32_t op1_info, op2_info;
1552115521

1552215522
switch (opline->opcode) {
15523-
case ZEND_QM_ASSIGN:
1552415523
case ZEND_SEND_VAR:
1552515524
case ZEND_SEND_VAL:
1552615525
case ZEND_SEND_VAL_EX:
15526+
return (opline->op2_type != IS_CONST);
15527+
case ZEND_QM_ASSIGN:
1552715528
case ZEND_IS_SMALLER:
1552815529
case ZEND_IS_SMALLER_OR_EQUAL:
1552915530
case ZEND_IS_EQUAL:
@@ -15717,6 +15718,9 @@ static zend_regset zend_jit_get_scratch_regset(const zend_op *opline, const zend
1571715718
/* break missing intentionally */
1571815719
case ZEND_SEND_VAL:
1571915720
case ZEND_SEND_VAL_EX:
15721+
if (opline->op2_type == IS_CONST) {
15722+
break;
15723+
}
1572015724
if (ssa_op->op1_use == current_var) {
1572115725
regset = ZEND_REGSET(ZREG_R0);
1572215726
break;
@@ -15733,6 +15737,9 @@ static zend_regset zend_jit_get_scratch_regset(const zend_op *opline, const zend
1573315737
}
1573415738
break;
1573515739
case ZEND_SEND_VAR:
15740+
if (opline->op2_type == IS_CONST) {
15741+
break;
15742+
}
1573615743
if (ssa_op->op1_use == current_var ||
1573715744
ssa_op->op1_def == current_var) {
1573815745
regset = ZEND_REGSET_EMPTY;

0 commit comments

Comments
 (0)