File tree Expand file tree Collapse file tree 3 files changed +33
-2
lines changed
Expand file tree Collapse file tree 3 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,10 @@ PHP NEWS
1414 . Fixed bug GH-12870 (Creating an xmlns attribute results in a DOMException).
1515 (nielsdos)
1616
17+ - Opcache:
18+ . Fixed oss-fuzz #64727 (JIT undefined array key warning may overwrite DIM
19+ with NULL when DIM is the same var as result). (ilutov)
20+
172107 Dec 2023, PHP 8.3.1RC1
1822
1923- Core:
Original file line number Diff line number Diff line change @@ -205,14 +205,14 @@ void ZEND_FASTCALL zend_jit_undefined_long_key(EXECUTE_DATA_D)
205205 zval * result = EX_VAR (opline -> result .var );
206206 zval * dim ;
207207
208- ZVAL_NULL (result );
209208 if (opline -> op2_type == IS_CONST ) {
210209 dim = RT_CONSTANT (opline , opline -> op2 );
211210 } else {
212211 dim = EX_VAR (opline -> op2 .var );
213212 }
214213 ZEND_ASSERT (Z_TYPE_P (dim ) == IS_LONG );
215214 zend_error (E_WARNING , "Undefined array key " ZEND_LONG_FMT , Z_LVAL_P (dim ));
215+ ZVAL_NULL (result );
216216}
217217
218218void ZEND_FASTCALL zend_jit_undefined_string_key (EXECUTE_DATA_D )
@@ -222,7 +222,6 @@ void ZEND_FASTCALL zend_jit_undefined_string_key(EXECUTE_DATA_D)
222222 zval * dim ;
223223 zend_ulong lval ;
224224
225- ZVAL_NULL (result );
226225 if (opline -> op2_type == IS_CONST ) {
227226 dim = RT_CONSTANT (opline , opline -> op2 );
228227 } else {
@@ -234,6 +233,7 @@ void ZEND_FASTCALL zend_jit_undefined_string_key(EXECUTE_DATA_D)
234233 } else {
235234 zend_error (E_WARNING , "Undefined array key \"%s\"" , Z_STRVAL_P (dim ));
236235 }
236+ ZVAL_NULL (result );
237237}
238238
239239ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_profile_helper (ZEND_OPCODE_HANDLER_ARGS )
Original file line number Diff line number Diff line change 1+ --TEST--
2+ oss-fuzz #64727
3+ --INI--
4+ opcache.enable_cli=1
5+ opcache.jit_buffer_size=64M
6+ opcache.jit=function
7+ --EXTENSIONS--
8+ opcache
9+ --FILE--
10+ <?php
11+ function test (){
12+ $ a = null ;
13+ $ b = null ;
14+ for ($ i = 0 ; $ i < 2 ; $ i ++){
15+ $ a = $ a + $ b ;
16+ var_dump ($ a );
17+ $ a = @[3 ][$ a ];
18+ var_dump ($ a );
19+ }
20+ }
21+ test ();
22+ ?>
23+ --EXPECT--
24+ int(0)
25+ int(3)
26+ int(3)
27+ NULL
You can’t perform that action at this time.
0 commit comments