-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CVE-2019-3557: Fix OOB read in readRecord on BZ2Files/OutputFiles
Summary: These File subclasses return -1 on read errors which is not what is expected for readImpl--this made File::readRecord behave unusually if the read fails, causing it to read (size_t)(-1) bytes from its stream buffer; which, unsurprisingly produces a out-of-bounds heap read. Reviewed By: leikahing, jjgriego Differential Revision: D13659395 fbshipit-source-id: 359ed6e3ff9f9cf49b752b666f51c4e0b3ce4b8a
- Loading branch information
Showing
4 changed files
with
18 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
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,12 @@ | ||
<?hh | ||
|
||
<<__EntryPoint>> | ||
function main() { | ||
$a = bzopen("/dev/null", "w"); | ||
$tmp = stream_get_line($a, 1, "1"); | ||
var_dump($tmp); | ||
|
||
$a = fopen("php://output", "w"); | ||
$tmp = stream_get_line($a, 1, "1"); | ||
var_dump($tmp); | ||
} |
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,4 @@ | ||
string(0) "" | ||
|
||
Warning: cannot read from a php://output stream in %s on line %d | ||
string(0) "" |