Skip to content

Commit 7051dc3

Browse files
committed
JIT: Fix memory leak
Fixes oss-fuzz #45658
1 parent 3d6a7e2 commit 7051dc3

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

ext/opcache/jit/zend_jit_helpers.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,10 @@ static zval* ZEND_FASTCALL zend_jit_fetch_dim_w_helper(zend_array *ht, zval *dim
860860
ZVAL_NULL(EX_VAR(opline->result.var));
861861
}
862862
}
863+
if (opline->opcode == ZEND_ASSIGN_DIM
864+
&& ((opline+1)->op1_type & (IS_VAR | IS_TMP_VAR))) {
865+
zval_ptr_dtor_nogc(EX_VAR((opline+1)->op1.var));
866+
}
863867
return NULL;
864868
}
865869
/* break missing intentionally */
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
JIT ASSIGN_DIM: 014
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+
set_error_handler(function($code, $err) {
11+
echo "Error: $err\n";
12+
$GLOBALS['a'] = null;
13+
});
14+
$a[$y] = function(){};
15+
?>
16+
DONE
17+
--EXPECT--
18+
Error: Undefined variable $y
19+
DONE

0 commit comments

Comments
 (0)