-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #77322: PharData::addEmptyDir('/') Possible integer overflow
`phar_path_check()` already strips a leading slash, so we must not attempt to strip the trailing slash from an now empty directory name. Closes GH-6508.
- Loading branch information
Showing
3 changed files
with
28 additions
and
2 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--TEST-- | ||
Bug #77322 (PharData::addEmptyDir('/') Possible integer overflow) | ||
--SKIPIF-- | ||
<?php | ||
if (!extension_loaded('phar')) die('skip phar extension not available'); | ||
?> | ||
--FILE-- | ||
<?php | ||
$zip = new PharData(__DIR__ . '/bug77322.zip'); | ||
$zip->addEmptyDir('/'); | ||
var_dump($zip->count()); | ||
|
||
$tar = new PharData(__DIR__ . '/bug77322.tar'); | ||
$tar->addEmptyDir('/'); | ||
var_dump($tar->count()); | ||
?> | ||
--EXPECT-- | ||
int(1) | ||
int(1) | ||
--CLEAN-- | ||
<?php | ||
unlink(__DIR__ . '/bug77322.zip'); | ||
unlink(__DIR__ . '/bug77322.tar'); | ||
?> |
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