Skip to content

Commit aa352c2

Browse files
committed
JIT: Fixed memory leak
Fixes oss-fuzz #45981
1 parent cf83bdd commit aa352c2

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

ext/opcache/jit/zend_jit_helpers.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2316,6 +2316,9 @@ static void ZEND_FASTCALL zend_jit_invalid_property_incdec(zval *container, cons
23162316
zend_throw_error(NULL,
23172317
"Attempt to increment/decrement property \"%s\" on %s",
23182318
property_name, zend_zval_type_name(container));
2319+
if (opline->op1_type == IS_VAR) {
2320+
zval_ptr_dtor_nogc(EX_VAR(opline->op1.var));
2321+
}
23192322
}
23202323

23212324
static void ZEND_FASTCALL zend_jit_invalid_property_assign(zval *container, const char *property_name)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
PRE_INC_OBJ: 005
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+
--FILE--
10+
<?php
11+
json_encode($y)->y++;
12+
?>
13+
--EXPECTF--
14+
Warning: Undefined variable $y in %sinc_obj_005.php on line 2
15+
16+
Fatal error: Uncaught Error: Attempt to increment/decrement property "y" on string in %sinc_obj_005.php:2
17+
Stack trace:
18+
#0 {main}
19+
thrown in %sinc_obj_005.php on line 2

0 commit comments

Comments
 (0)