1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00

Merge branch 'PHP-8.4' into PHP-8.5

This commit is contained in:
David Carlier
2025-09-29 22:48:55 +01:00
2 changed files with 13 additions and 8 deletions

View File

@@ -0,0 +1,12 @@
--TEST--
GH-19922 (gzopen double free on debug build and unseekable stream)
--EXTENSIONS--
zlib
--FILE--
<?php
var_dump(gzopen("php://output", 14));
?>
--EXPECTF--
Warning: gzopen(php://output): could not make seekable - php://output in %s on line %d
bool(false)

View File

@@ -2217,7 +2217,6 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mod
int persistent = options & STREAM_OPEN_PERSISTENT;
zend_string *path_str = NULL;
zend_string *resolved_path = NULL;
char *copy_of_path = NULL;
if (opened_path) {
if (options & STREAM_OPEN_FOR_ZEND_STREAM) {
@@ -2294,8 +2293,7 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mod
if (stream->orig_path) {
pefree(stream->orig_path, persistent);
}
copy_of_path = pestrdup(path, persistent);
stream->orig_path = copy_of_path;
stream->orig_path = pestrdup(path, persistent);
#if ZEND_DEBUG
stream->open_filename = __zend_orig_filename ? __zend_orig_filename : __zend_filename;
stream->open_lineno = __zend_orig_lineno ? __zend_orig_lineno : __zend_lineno;
@@ -2354,11 +2352,6 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mod
}
}
php_stream_tidy_wrapper_error_log(wrapper);
#if ZEND_DEBUG
if (stream == NULL && copy_of_path != NULL) {
pefree(copy_of_path, persistent);
}
#endif
if (resolved_path) {
zend_string_release_ex(resolved_path, 0);
}