Skip to content

Commit 1c5f0b8

Browse files
committed
Check for undef var in verify return jit
1 parent 213852d commit 1c5f0b8

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11590,19 +11590,27 @@ static zend_bool zend_jit_verify_return_type(dasm_State **Dst, const zend_op *op
1159011590

1159111591
uint32_t type_mask = ZEND_TYPE_PURE_MASK(arg_info->type);
1159211592
if (type_mask == 0) {
11593-
| jmp >8
11593+
| jmp >7
1159411594
} else if (is_power_of_two(type_mask)) {
1159511595
uint32_t type_code = concrete_type(type_mask);
1159611596
| cmp byte [r0 + 8], type_code
11597-
| jne >8
11597+
| jne >7
1159811598
} else {
1159911599
| mov edx, 1
1160011600
| mov cl, byte [r0 + 8]
1160111601
| shl edx, cl
1160211602
| test edx, type_mask
11603-
| je >8
11603+
| je >7
1160411604
}
1160511605
|.cold_code
11606+
|7:
11607+
| SAVE_VALID_OPLINE opline, r1
11608+
if (op1_info & MAY_BE_UNDEF) {
11609+
| IF_NOT_ZVAL_TYPE op1_addr, IS_UNDEF, >8
11610+
| mov FCARG1a, opline->op1.var
11611+
| EXT_CALL zend_jit_undefined_op_helper, r1
11612+
| LOAD_ADDR_ZTS r0, executor_globals, uninitialized_zval
11613+
}
1160611614
|8:
1160711615
| mov FCARG1a, r0
1160811616
| mov r0, EX->run_time_cache
@@ -11611,13 +11619,11 @@ static zend_bool zend_jit_verify_return_type(dasm_State **Dst, const zend_op *op
1161111619
|.if X64
1161211620
| LOAD_ADDR CARG3, (ptrdiff_t)arg_info
1161311621
| mov CARG4, r0
11614-
| SAVE_VALID_OPLINE opline, r0
1161511622
| EXT_CALL zend_jit_verify_return_slow, r0
1161611623
|.else
1161711624
| sub r4, 8
1161811625
| push r0
1161911626
| push (ptrdiff_t)arg_info
11620-
| SAVE_VALID_OPLINE opline, r0
1162111627
| EXT_CALL zend_jit_verify_return_slow, r0
1162211628
| add r4, 8
1162311629
|.endif

0 commit comments

Comments
 (0)