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

Merge branch 'PHP-8.3' into PHP-8.4

* PHP-8.3:
  phar: Fix memleak+UAF when opening temp stream in buildFromDirectory() fails
This commit is contained in:
Niels Dossche
2025-10-13 21:02:39 +02:00
2 changed files with 6 additions and 0 deletions

2
NEWS
View File

@@ -33,6 +33,8 @@ PHP NEWS
. Fix a bunch of memory leaks in phar_parse_zipfile() error handling.
(nielsdos)
. Fix file descriptor/memory leak when opening central fp fails. (nielsdos)
. Fix memleak+UAF when opening temp stream in buildFromDirectory() fails.
(nielsdos)
- Random:
. Fix Randomizer::__serialize() w.r.t. INDIRECTs. (nielsdos)

View File

@@ -1792,6 +1792,10 @@ PHP_METHOD(Phar, buildFromDirectory)
pass.ret = return_value;
pass.fp = php_stream_fopen_tmpfile();
if (pass.fp == NULL) {
zval_ptr_dtor(&iteriter);
if (apply_reg) {
zval_ptr_dtor(&regexiter);
}
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" unable to create temporary file", phar_obj->archive->fname);
RETURN_THROWS();
}