Skip to content

Commit 722a8b0

Browse files
committed
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: phar: Fix memleak+UAF when opening temp stream in buildFromDirectory() fails
2 parents 5ce0019 + ffc548d commit 722a8b0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ext/phar/phar_object.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1792,6 +1792,10 @@ PHP_METHOD(Phar, buildFromDirectory)
17921792
pass.ret = return_value;
17931793
pass.fp = php_stream_fopen_tmpfile();
17941794
if (pass.fp == NULL) {
1795+
zval_ptr_dtor(&iteriter);
1796+
if (apply_reg) {
1797+
zval_ptr_dtor(&regexiter);
1798+
}
17951799
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" unable to create temporary file", phar_obj->archive->fname);
17961800
RETURN_THROWS();
17971801
}

0 commit comments

Comments
 (0)