Skip to content

Commit 655e578

Browse files
committed
JIT: Fix exception handling
Fixes oss-fuzz #43618
1 parent 797e091 commit 655e578

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

ext/opcache/jit/zend_jit_helpers.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2379,6 +2379,9 @@ static zval * ZEND_FASTCALL zend_jit_prepare_assign_dim_ref(zval *ref) {
23792379
if (Z_TYPE_P(val) == IS_FALSE) {
23802380
ZVAL_ARR(val, zend_new_array(8));
23812381
zend_false_to_array_deprecated();
2382+
if (EG(exception)) {
2383+
return NULL;
2384+
}
23822385
} else {
23832386
ZVAL_ARR(val, zend_new_array(8));
23842387
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
JIT ASSIGN_DIM: 011
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+
$my_var = null <
11+
set_error_handler(function($code, $msg) use(&$my_var) {
12+
echo "Err: $msg\n";
13+
$my_var[] = $my_var = 0;
14+
});
15+
try {
16+
$my_var[] = "";
17+
} catch (Throwable $e) {
18+
echo "Exception: " . $e->getMessage() . "\n";
19+
}
20+
?>
21+
DONE
22+
--EXPECT--
23+
Err: Automatic conversion of false to array is deprecated
24+
Exception: Cannot use a scalar value as an array
25+
DONE

0 commit comments

Comments
 (0)