Skip to content

Commit

Permalink
Check for undef var in verify return jit
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Jul 13, 2020
1 parent 213852d commit 1c5f0b8
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions ext/opcache/jit/zend_jit_x86.dasc
Original file line number Diff line number Diff line change
Expand Up @@ -11590,19 +11590,27 @@ static zend_bool zend_jit_verify_return_type(dasm_State **Dst, const zend_op *op

uint32_t type_mask = ZEND_TYPE_PURE_MASK(arg_info->type);
if (type_mask == 0) {
| jmp >8
| jmp >7
} else if (is_power_of_two(type_mask)) {
uint32_t type_code = concrete_type(type_mask);
| cmp byte [r0 + 8], type_code
| jne >8
| jne >7
} else {
| mov edx, 1
| mov cl, byte [r0 + 8]
| shl edx, cl
| test edx, type_mask
| je >8
| je >7
}
|.cold_code
|7:
| SAVE_VALID_OPLINE opline, r1
if (op1_info & MAY_BE_UNDEF) {
| IF_NOT_ZVAL_TYPE op1_addr, IS_UNDEF, >8
| mov FCARG1a, opline->op1.var
| EXT_CALL zend_jit_undefined_op_helper, r1

This comment has been minimized.

Copy link
@cmb69

cmb69 Jul 13, 2020

Contributor

@nikic, this commit lets Zend/tests/bug79828.phpt crash on 64bit Windows builds. r0 (instead of r1) appears to hold the proper offset, though.

| LOAD_ADDR_ZTS r0, executor_globals, uninitialized_zval
}
|8:
| mov FCARG1a, r0
| mov r0, EX->run_time_cache
Expand All @@ -11611,13 +11619,11 @@ static zend_bool zend_jit_verify_return_type(dasm_State **Dst, const zend_op *op
|.if X64
| LOAD_ADDR CARG3, (ptrdiff_t)arg_info
| mov CARG4, r0
| SAVE_VALID_OPLINE opline, r0
| EXT_CALL zend_jit_verify_return_slow, r0
|.else
| sub r4, 8
| push r0
| push (ptrdiff_t)arg_info
| SAVE_VALID_OPLINE opline, r0
| EXT_CALL zend_jit_verify_return_slow, r0
| add r4, 8
|.endif
Expand Down

0 comments on commit 1c5f0b8

Please sign in to comment.