Skip to content

Commit a506b00

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: JIT: Fixed register clobbering during overflow handling
2 parents 0eb96b6 + 912608d commit a506b00

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4490,11 +4490,11 @@ static int zend_jit_math_long_long(dasm_State **Dst,
44904490
(Z_MODE(op2_addr) == IS_CONST_ZVAL && Z_LVAL_P(Z_ZV(op2_addr)) == 1))) {
44914491
if (opcode == ZEND_ADD) {
44924492
|.if X64
4493-
| mov64 rax, 0x43e0000000000000
4493+
| mov64 Ra(tmp_reg), 0x43e0000000000000
44944494
if (Z_MODE(res_addr) == IS_REG) {
4495-
| movd xmm(Z_REG(res_addr)-ZREG_XMM0), rax
4495+
| movd xmm(Z_REG(res_addr)-ZREG_XMM0), Ra(tmp_reg)
44964496
} else {
4497-
| SET_ZVAL_LVAL res_addr, rax
4497+
| SET_ZVAL_LVAL res_addr, Ra(tmp_reg)
44984498
}
44994499
|.else
45004500
| SET_ZVAL_LVAL res_addr, 0
@@ -4503,11 +4503,11 @@ static int zend_jit_math_long_long(dasm_State **Dst,
45034503
break;
45044504
} else if (opcode == ZEND_SUB) {
45054505
|.if X64
4506-
| mov64 rax, 0xc3e0000000000000
4506+
| mov64 Ra(tmp_reg), 0xc3e0000000000000
45074507
if (Z_MODE(res_addr) == IS_REG) {
4508-
| movd xmm(Z_REG(res_addr)-ZREG_XMM0), rax
4508+
| movd xmm(Z_REG(res_addr)-ZREG_XMM0), Ra(tmp_reg)
45094509
} else {
4510-
| SET_ZVAL_LVAL res_addr, rax
4510+
| SET_ZVAL_LVAL res_addr, Ra(tmp_reg)
45114511
}
45124512
|.else
45134513
| SET_ZVAL_LVAL res_addr, 0x00200000
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
JIT ASSIGN_DIM_OP: overflow
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+
class test {
11+
public$member;
12+
function __construct(){
13+
$this->member = 9223372036854775807;
14+
$this->member += 1;
15+
}
16+
}
17+
new test();
18+
?>
19+
DONE
20+
--EXPECT--
21+
DONE

0 commit comments

Comments
 (0)