Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #81490: ZipArchive::extractTo() may leak memory
We always need to free the CWD state. Closes GH-7536.
- Loading branch information
Showing
3 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--TEST-- | ||
Bug #81490 (ZipArchive::extractTo() may leak memory) | ||
--SKIPIF-- | ||
<?php | ||
if (!extension_loaded("zip")) die("skip zip extension not available"); | ||
?> | ||
--FILE-- | ||
<?php | ||
$zip = new ZipArchive(); | ||
$zip->open(__DIR__ . "/bug81490.zip", ZipArchive::CREATE|ZipArchive::OVERWRITE); | ||
$zip->addFromString("", "yada yada"); | ||
mkdir(__DIR__ . "/bug81490"); | ||
$zip->open(__DIR__ . "/bug81490.zip"); | ||
$zip->extractTo(__DIR__ . "/bug81490", ""); | ||
?> | ||
--EXPECT-- | ||
--CLEAN-- | ||
<?php | ||
@unlink(__DIR__ . "/bug81490.zip"); | ||
@rmdir(__DIR__ . "/bug81490"); | ||
?> |
4d44271
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cmb69 thanks
FYI, also applied in pecl/zip pierrejoye/php_zip@80bcec9