forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix phpGH-17139: Fix zip_entry_name() crash on invalid entry.
Increasing the GC refcount when reading the zip entry before zip_entry_name() fetches the info, leading to a dangling pointer otherwise.
- Loading branch information
Showing
2 changed files
with
20 additions
and
0 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,19 @@ | ||
--TEST-- | ||
GH-17139 - zip_entry_name() crash | ||
--EXTENSIONS-- | ||
zip | ||
--FILE-- | ||
<?php | ||
$zip = zip_open(__DIR__."/test_procedural.zip"); | ||
if (!is_resource($zip)) die("Failure"); | ||
// no need to bother looping over, the entry name should point to a dangling address from the first iteration | ||
$zip = zip_read($zip); | ||
var_dump(zip_entry_name($zip)); | ||
?> | ||
--EXPECTF-- | ||
Deprecated: Function zip_open() is deprecated in %s on line %d | ||
|
||
Deprecated: Function zip_read() is deprecated in %s on line %d | ||
|
||
Deprecated: Function zip_entry_name() is deprecated in %s on line %d | ||
string(3) "foo" |