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

Merge branch 'PHP-8.5'

* PHP-8.5:
  phar: Fix memleak+UAF when opening temp stream in buildFromDirectory() fails
This commit is contained in:
Niels Dossche
2025-10-13 21:02:52 +02:00

View File

@@ -1781,6 +1781,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();
}