[php-src] master: Merge branch 'PHP-8.4' into PHP-8.5
| From: | ndossche | Date: | Mon, 21 Sep 2026 20:55:33 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.4' into PHP-8.5 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141353@lists.php.net to get a copy of this message | ||
Author: ndossche (ndossche)
Date: 2026-09-21T22:55:17+02:00
Commit: https://github.com/php/php-src/commit/00bbe2d09f46f2ea85eba03b1138d262848800f2
Raw diff: https://github.com/php/php-src/commit/00bbe2d09f46f2ea85eba03b1138d262848800f2.diff
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
Fix OSS-Fuzz #5674034779193344: Read of uninitialized memory in is_cacheable_stream_path()
Changed paths:
M NEWS
M ext/opcache/ZendAccelerator.c
Diff:
diff --git a/NEWS b/NEWS
index b57861f46564..94efff225147 100644
--- a/NEWS
+++ b/NEWS
@@ -53,6 +53,8 @@ PHP NEWS
FCCs and inlining). (ndossche)
. Fixed bug GH-23693 (Tracing JIT produces wrong results for a guard on a
loop-invariant addition). (Ilia Alshanetsky)
+ . Fixed OSS-Fuzz #5674034779193344 (Read of uninitialized memory in
+ is_cacheable_stream_path()). (ndossche)
- PDO:
. Fixed PDOStatement::getColumnMeta() reading out of bounds for an invalid
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index 0b685c6e1fec..951d042767d1 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -202,10 +202,10 @@ static time_t zend_accel_get_time(void)
# define zend_accel_get_time() time(NULL)
#endif
-static inline bool is_cacheable_stream_path(const char *filename)
+static inline bool is_cacheable_stream_path(const zend_string *filename)
{
- return memcmp(filename, "file://", sizeof("file://") - 1) == 0 ||
- memcmp(filename, "phar://", sizeof("phar://") - 1) == 0;
+ return zend_string_starts_with_literal(filename, "file://") ||
+ zend_string_starts_with_literal(filename, "phar://");
}
/* O+ overrides PHP chdir() function and remembers the current working directory
@@ -1212,7 +1212,7 @@ zend_string *accel_make_persistent_key(zend_string *str)
if (IS_ABSOLUTE_PATH(path, path_length)) {
/* pass */
} else if (UNEXPECTED(php_is_stream_path(path))) {
- if (!is_cacheable_stream_path(path)) {
+ if (!is_cacheable_stream_path(str)) {
return NULL;
}
/* pass */
@@ -1890,7 +1890,7 @@ static zend_op_array *file_cache_compile_file(zend_file_handle *file_handle,
int
bool from_memory; /* if the script we've got is stored in SHM */
if (php_is_stream_path(ZSTR_VAL(file_handle->filename)) &&
- !is_cacheable_stream_path(ZSTR_VAL(file_handle->filename))) {
+ !is_cacheable_stream_path(file_handle->filename)) {
return accelerator_orig_compile_file(file_handle, type);
}
@@ -2048,7 +2048,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int
type)
return accelerator_orig_compile_file(file_handle, type);
}
persistent_script = zend_accel_hash_find(&ZCSG(hash), key);
- } else if (UNEXPECTED(php_is_stream_path(ZSTR_VAL(file_handle->filename)) &&
!is_cacheable_stream_path(ZSTR_VAL(file_handle->filename)))) {
+ } else if (UNEXPECTED(php_is_stream_path(ZSTR_VAL(file_handle->filename)) &&
!is_cacheable_stream_path(file_handle->filename))) {
ZCG(cache_opline) = NULL;
ZCG(cache_persistent_script) = NULL;
return accelerator_orig_compile_file(file_handle, type);