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

Fix memory leak in phar_parse_zipfile() error handling

Closes GH-20134.
This commit is contained in:
Niels Dossche
2025-10-11 12:56:10 +02:00
parent efa1fafc2f
commit 416386acc4
2 changed files with 7 additions and 3 deletions

1
NEWS
View File

@@ -18,6 +18,7 @@ PHP NEWS
- Phar:
. Fix memory leak of argument in webPhar. (nielsdos)
. Fix memory leak when setAlias() fails. (nielsdos)
. Fix memory leak in phar_parse_zipfile() error handling. (nielsdos)
- Random:
. Fix Randomizer::__serialize() w.r.t. INDIRECTs. (nielsdos)

View File

@@ -641,7 +641,8 @@ foundit:
}
}
if (!entry.uncompressed_filesize || !actual_alias) {
if (!entry.uncompressed_filesize) {
efree(actual_alias);
php_stream_filter_remove(filter, 1);
pefree(entry.filename, entry.is_persistent);
PHAR_ZIP_FAIL("unable to read in alias, truncated");
@@ -674,7 +675,8 @@ foundit:
}
}
if (!entry.uncompressed_filesize || !actual_alias) {
if (!entry.uncompressed_filesize) {
efree(actual_alias);
php_stream_filter_remove(filter, 1);
pefree(entry.filename, entry.is_persistent);
PHAR_ZIP_FAIL("unable to read in alias, truncated");
@@ -697,7 +699,8 @@ foundit:
}
}
if (!entry.uncompressed_filesize || !actual_alias) {
if (!entry.uncompressed_filesize) {
efree(actual_alias);
pefree(entry.filename, entry.is_persistent);
PHAR_ZIP_FAIL("unable to read in alias, truncated");
}