Skip to content

Commit 94b8001

Browse files
committed
Fixed conditional jump on uninitialised value (Zend/tests/match/028.phpt failure with function JIT)
1 parent 1c6df2d commit 94b8001

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

ext/opcache/jit/zend_jit_arm64.dasc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9460,6 +9460,11 @@ static int zend_jit_send_val(dasm_State **Dst, const zend_op *opline, uint32_t o
94609460
| bne >1
94619461
|.cold_code
94629462
|1:
9463+
if (Z_MODE(op1_addr) == IS_REG) {
9464+
/* set type to avoid zval_ptr_dtor() on uninitialized value */
9465+
zend_jit_addr addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->op1.var);
9466+
| SET_ZVAL_TYPE_INFO addr, IS_UNDEF, TMP1w, TMP2
9467+
}
94639468
| SET_EX_OPLINE opline, REG0
94649469
| b ->throw_cannot_pass_by_ref
94659470
|.code

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10091,6 +10091,11 @@ static int zend_jit_send_val(dasm_State **Dst, const zend_op *opline, uint32_t o
1009110091
| jnz >1
1009210092
|.cold_code
1009310093
|1:
10094+
if (Z_MODE(op1_addr) == IS_REG) {
10095+
/* set type to avoid zval_ptr_dtor() on uninitialized value */
10096+
zend_jit_addr addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->op1.var);
10097+
| SET_ZVAL_TYPE_INFO addr, IS_UNDEF
10098+
}
1009410099
| SET_EX_OPLINE opline, r0
1009510100
| jmp ->throw_cannot_pass_by_ref
1009610101
|.code

0 commit comments

Comments
 (0)