Skip to content

Commit 522406c

Browse files
committed
JIT: Fix incorrect flag check
Fixes oss-fuzz #43538
1 parent d8b0337 commit 522406c

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6062,7 +6062,7 @@ static int zend_jit_simple_assign(dasm_State **Dst,
60626062
if (tmp_reg == ZREG_R0) {
60636063
| IF_NOT_REFCOUNTED ah, >3
60646064
} else {
6065-
| IF_NOT_FLAGS Rd(tmp_reg), IS_TYPE_REFCOUNTED, >3
6065+
| IF_NOT_FLAGS Rd(tmp_reg), (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT), >3
60666066
}
60676067
| GET_ZVAL_PTR Ra(tmp_reg), var_addr
60686068

@@ -6077,7 +6077,7 @@ static int zend_jit_simple_assign(dasm_State **Dst,
60776077
if (tmp_reg == ZREG_R0) {
60786078
| IF_NOT_REFCOUNTED ah, >2
60796079
} else {
6080-
| IF_NOT_FLAGS Rd(tmp_reg), IS_TYPE_REFCOUNTED, >2
6080+
| IF_NOT_FLAGS Rd(tmp_reg), (IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT), >2
60816081
}
60826082
| GET_ZVAL_PTR Ra(tmp_reg), var_addr
60836083
| GC_ADDREF Ra(tmp_reg)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--TEST--
2+
JIT ASSIGN_DIM: 009
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
--FILE--
9+
<?php
10+
$y[] = $r = &$G;
11+
?>
12+
DONE
13+
--EXPECT--
14+
DONE

0 commit comments

Comments
 (0)