Skip to content

Commit 67719e0

Browse files
committed
Merge branch 'PHP-8.5'
* PHP-8.5: phar: Fix memleak+UAF when opening temp stream in buildFromDirectory() fails
2 parents b9aa42e + 722a8b0 commit 67719e0

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
@@ -1781,6 +1781,10 @@ PHP_METHOD(Phar, buildFromDirectory)
17811781
pass.ret = return_value;
17821782
pass.fp = php_stream_fopen_tmpfile();
17831783
if (pass.fp == NULL) {
1784+
zval_ptr_dtor(&iteriter);
1785+
if (apply_reg) {
1786+
zval_ptr_dtor(&regexiter);
1787+
}
17841788
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" unable to create temporary file", phar_obj->archive->fname);
17851789
RETURN_THROWS();
17861790
}

0 commit comments

Comments
 (0)