From e9331ede82540cecd7d160cb9dfc47e6b4b4912f Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 18 Sep 2025 11:33:44 +0200 Subject: more upstream patches for PHP 8.5 --- ...leak-in-zip-when-encountering-empty-glob-.patch | 160 +++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 0001-Fix-memory-leak-in-zip-when-encountering-empty-glob-.patch (limited to '0001-Fix-memory-leak-in-zip-when-encountering-empty-glob-.patch') diff --git a/0001-Fix-memory-leak-in-zip-when-encountering-empty-glob-.patch b/0001-Fix-memory-leak-in-zip-when-encountering-empty-glob-.patch new file mode 100644 index 0000000..1950f49 --- /dev/null +++ b/0001-Fix-memory-leak-in-zip-when-encountering-empty-glob-.patch @@ -0,0 +1,160 @@ +From 93046609eae6d4c9d57761863cc2bc590a6355e7 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Thu, 18 Sep 2025 11:08:36 +0200 +Subject: [PATCH 1/4] Fix memory leak in zip when encountering empty glob + result + +From https://github.com/php/php-src/commit/216e87ad7e33fda75f33e31c36a30b04b90e4696 +--- + php5/php_zip.c | 2 -- + php7/php_zip.c | 2 -- + php73/php_zip.c | 2 -- + php74/php_zip.c | 2 -- + php8/php_zip.c | 2 -- + php81/php_zip.c | 2 -- + php85/php_zip.c | 2 -- + 7 files changed, 14 deletions(-) + +diff --git a/php5/php_zip.c b/php5/php_zip.c +index 5dda462..8d16d3b 100644 +--- a/php5/php_zip.c ++++ b/php5/php_zip.c +@@ -706,7 +706,6 @@ int php_zip_glob(char *pattern, int pattern_len, long flags, zval *return_value + can be used for simple glob() calls without further error + checking. + */ +- array_init(return_value); + return 0; + } + #endif +@@ -715,7 +714,6 @@ int php_zip_glob(char *pattern, int pattern_len, long flags, zval *return_value + + /* now catch the FreeBSD style of "no matches" */ + if (!globbuf.gl_pathc || !globbuf.gl_pathv) { +- array_init(return_value); + return 0; + } + +diff --git a/php7/php_zip.c b/php7/php_zip.c +index bffed61..d962618 100644 +--- a/php7/php_zip.c ++++ b/php7/php_zip.c +@@ -668,7 +668,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v + can be used for simple glob() calls without further error + checking. + */ +- array_init(return_value); + return 0; + } + #endif +@@ -677,7 +676,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v + + /* now catch the FreeBSD style of "no matches" */ + if (!globbuf.gl_pathc || !globbuf.gl_pathv) { +- array_init(return_value); + return 0; + } + +diff --git a/php73/php_zip.c b/php73/php_zip.c +index 0635a84..eb2c5b6 100644 +--- a/php73/php_zip.c ++++ b/php73/php_zip.c +@@ -668,7 +668,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v + can be used for simple glob() calls without further error + checking. + */ +- array_init(return_value); + return 0; + } + #endif +@@ -677,7 +676,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v + + /* now catch the FreeBSD style of "no matches" */ + if (!globbuf.gl_pathc || !globbuf.gl_pathv) { +- array_init(return_value); + return 0; + } + +diff --git a/php74/php_zip.c b/php74/php_zip.c +index 0cd33ad..f987056 100644 +--- a/php74/php_zip.c ++++ b/php74/php_zip.c +@@ -664,7 +664,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v + can be used for simple glob() calls without further error + checking. + */ +- array_init(return_value); + return 0; + } + #endif +@@ -673,7 +672,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v + + /* now catch the FreeBSD style of "no matches" */ + if (!globbuf.gl_pathc || !globbuf.gl_pathv) { +- array_init(return_value); + return 0; + } + +diff --git a/php8/php_zip.c b/php8/php_zip.c +index 5328c25..8129c15 100644 +--- a/php8/php_zip.c ++++ b/php8/php_zip.c +@@ -674,7 +674,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v + can be used for simple glob() calls without further error + checking. + */ +- array_init(return_value); + return 0; + } + #endif +@@ -683,7 +682,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v + + /* now catch the FreeBSD style of "no matches" */ + if (!globbuf.gl_pathc || !globbuf.gl_pathv) { +- array_init(return_value); + return 0; + } + +diff --git a/php81/php_zip.c b/php81/php_zip.c +index ddcf47f..8bc582d 100644 +--- a/php81/php_zip.c ++++ b/php81/php_zip.c +@@ -676,7 +676,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v + can be used for simple glob() calls without further error + checking. + */ +- array_init(return_value); + return 0; + } + #endif +@@ -685,7 +684,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v + + /* now catch the FreeBSD style of "no matches" */ + if (!globbuf.gl_pathc || !globbuf.gl_pathv) { +- array_init(return_value); + return 0; + } + +diff --git a/php85/php_zip.c b/php85/php_zip.c +index d5f7b01..604b403 100644 +--- a/php85/php_zip.c ++++ b/php85/php_zip.c +@@ -628,7 +628,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v + can be used for simple glob() calls without further error + checking. + */ +- array_init(return_value); + return 0; + } + #endif +@@ -637,7 +636,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v + + /* now catch the FreeBSD style of "no matches" */ + if (!globbuf.gl_pathc || !globbuf.gl_pathv) { +- array_init(return_value); + return 0; + } + +-- +2.51.0 + -- cgit