Commit 778f3ff6b18 for php
commit 778f3ff6b188740e83855f6a0282f860b240b5be
Author: ndossche <7771979+ndossche@users.noreply.github.com>
Date: Tue Nov 24 20:18:27 2026 +0100
Fix OSS-Fuzz #588264417
Ref: https://issues.oss-fuzz.com/issues/588264417
The phi type had a double AND, and the type was derived incorrectly.
Since the `var_def_info` variable may be overwritten with ANY, it
incorrectly could match on a `MAY_BE_LONG` mask.
Instead, the easy approach is to take the type from the inputs.
Closes GH-25717.
diff --git a/NEWS b/NEWS
index 7f78337562e..7405d2f6ac0 100644
--- a/NEWS
+++ b/NEWS
@@ -36,6 +36,7 @@ PHP NEWS
. Fixed propagation of public(set) of readonly trait property. (ilutov)
. Fixed bug GH-25313 (Assertion !EG(exception) in ZEND_FE_FREE when unpacking
a generator into a by-ref parameter throws). (ndossche)
+ . Fix OSS-Fuzz #588264417. (ndossche)
- Curl:
. Fixed curl_reset() retaining CURLOPT_PRIVATE after reset. (lacatoire)
diff --git a/ext/opcache/jit/zend_jit_ir.c b/ext/opcache/jit/zend_jit_ir.c
index 1cdd92e1240..2eea0dfe978 100644
--- a/ext/opcache/jit/zend_jit_ir.c
+++ b/ext/opcache/jit/zend_jit_ir.c
@@ -6850,7 +6850,9 @@ static int zend_jit_assign_to_variable(zend_jit_ctx *jit,
if (res_inputs->count == 1) {
phi = res_inputs->refs[0];
} else {
- phi = ir_PHI_N((var_def_info & MAY_BE_LONG & MAY_BE_LONG) ? IR_LONG : IR_DOUBLE,
+ /* var_def_info may be ANY (e.g. ASSIGN_DIM) so use the fact that phi inputs must be the same type,
+ * and therefore use the type of the incoming values. */
+ phi = ir_PHI_N(jit->ctx.ir_base[res_inputs->refs[0]].type,
res_inputs->count, res_inputs->refs);
}
if (Z_MODE(var_addr) == IS_REG) {
diff --git a/ext/opcache/tests/jit/assign_dim_028.phpt b/ext/opcache/tests/jit/assign_dim_028.phpt
new file mode 100644
index 00000000000..85c4431a14e
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_dim_028.phpt
@@ -0,0 +1,27 @@
+--TEST--
+JIT ASSIGN_DIM: result in double register with multiple assignment paths
+--EXTENSIONS--
+opcache
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.jit=function
+--FILE--
+<?php
+
+function f($k) {
+ $x = [];
+ for ($i = 0; $i < 3; $i++) {
+ $a + $x[] = $k;
+ $a = $b = $a = $x[$k . $k] = 0.5;
+ }
+ var_dump($a, $b);
+}
+
+f("1");
+
+?>
+--EXPECTF--
+Warning: Undefined variable $a in %s on line %d
+float(0.5)
+float(0.5)