Skip to content

Commit 29bfb43

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix memory leak in phar_parse_zipfile() error handling
2 parents aa1585f + 416386a commit 29bfb43

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ PHP NEWS
2020
- Phar:
2121
. Fix memory leak of argument in webPhar. (nielsdos)
2222
. Fix memory leak when setAlias() fails. (nielsdos)
23+
. Fix memory leak in phar_parse_zipfile() error handling. (nielsdos)
2324

2425
- Random:
2526
. Fix Randomizer::__serialize() w.r.t. INDIRECTs. (nielsdos)

ext/phar/zip.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,8 @@ int phar_parse_zipfile(php_stream *fp, char *fname, size_t fname_len, char *alia
673673
}
674674
}
675675

676-
if (!entry.uncompressed_filesize || !actual_alias) {
676+
if (!entry.uncompressed_filesize) {
677+
efree(actual_alias);
677678
php_stream_filter_remove(filter, 1);
678679
pefree(entry.filename, entry.is_persistent);
679680
PHAR_ZIP_FAIL("unable to read in alias, truncated");
@@ -706,7 +707,8 @@ int phar_parse_zipfile(php_stream *fp, char *fname, size_t fname_len, char *alia
706707
}
707708
}
708709

709-
if (!entry.uncompressed_filesize || !actual_alias) {
710+
if (!entry.uncompressed_filesize) {
711+
efree(actual_alias);
710712
php_stream_filter_remove(filter, 1);
711713
pefree(entry.filename, entry.is_persistent);
712714
PHAR_ZIP_FAIL("unable to read in alias, truncated");
@@ -729,7 +731,8 @@ int phar_parse_zipfile(php_stream *fp, char *fname, size_t fname_len, char *alia
729731
}
730732
}
731733

732-
if (!entry.uncompressed_filesize || !actual_alias) {
734+
if (!entry.uncompressed_filesize) {
735+
efree(actual_alias);
733736
pefree(entry.filename, entry.is_persistent);
734737
PHAR_ZIP_FAIL("unable to read in alias, truncated");
735738
}

0 commit comments

Comments
 (0)