Skip to content

Commit 02952d3

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: JIT: Fixed register clobbering during overflow handling
2 parents 3a069da + a506b00 commit 02952d3

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
@@ -4485,11 +4485,11 @@ static int zend_jit_math_long_long(dasm_State **Dst,
44854485
(Z_MODE(op2_addr) == IS_CONST_ZVAL && Z_LVAL_P(Z_ZV(op2_addr)) == 1))) {
44864486
if (opcode == ZEND_ADD) {
44874487
|.if X64
4488-
| mov64 rax, 0x43e0000000000000
4488+
| mov64 Ra(tmp_reg), 0x43e0000000000000
44894489
if (Z_MODE(res_addr) == IS_REG) {
4490-
| movd xmm(Z_REG(res_addr)-ZREG_XMM0), rax
4490+
| movd xmm(Z_REG(res_addr)-ZREG_XMM0), Ra(tmp_reg)
44914491
} else {
4492-
| SET_ZVAL_LVAL res_addr, rax
4492+
| SET_ZVAL_LVAL res_addr, Ra(tmp_reg)
44934493
}
44944494
|.else
44954495
| SET_ZVAL_LVAL res_addr, 0
@@ -4498,11 +4498,11 @@ static int zend_jit_math_long_long(dasm_State **Dst,
44984498
break;
44994499
} else if (opcode == ZEND_SUB) {
45004500
|.if X64
4501-
| mov64 rax, 0xc3e0000000000000
4501+
| mov64 Ra(tmp_reg), 0xc3e0000000000000
45024502
if (Z_MODE(res_addr) == IS_REG) {
4503-
| movd xmm(Z_REG(res_addr)-ZREG_XMM0), rax
4503+
| movd xmm(Z_REG(res_addr)-ZREG_XMM0), Ra(tmp_reg)
45044504
} else {
4505-
| SET_ZVAL_LVAL res_addr, rax
4505+
| SET_ZVAL_LVAL res_addr, Ra(tmp_reg)
45064506
}
45074507
|.else
45084508
| 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)