Skip to content

Commit 5e3eaf1

Browse files
committed
JIT: Fixed memory leak in BOOL_NOT when opearnd ia a reference to bool
1 parent 83f283f commit 5e3eaf1

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8309,7 +8309,7 @@ static int zend_jit_bool_jmpznz(dasm_State **Dst, const zend_op *opline, uint32_
83098309
return 1;
83108310
}
83118311

8312-
if (op1_info & MAY_BE_REF) {
8312+
if (opline->op1_type == IS_CV && (op1_info & MAY_BE_REF)) {
83138313
| LOAD_ZVAL_ADDR FCARG1a, op1_addr
83148314
| ZVAL_DEREF FCARG1a, op1_info
83158315
op1_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
JIT BOOL_NOT: 001 Memory leak in case of reference to bool
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
opcache.protect_memory=1
9+
opcache.jit=function
10+
--SKIPIF--
11+
<?php require_once('skipif.inc'); ?>
12+
--FILE--
13+
<?php
14+
function test() {
15+
$a = true;
16+
var_dump(!$b =& $a);
17+
}
18+
test();
19+
?>
20+
--EXPECT--
21+
bool(false)

0 commit comments

Comments
 (0)