-
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 leak of invalid stream_read() return value
Fixes oss-fuzz 6225190686687232 (part of #38542).
- Loading branch information
Showing
2 changed files
with
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--TEST-- | ||
Returning an object from stream_read() is invalid, but should not leak | ||
--FILE-- | ||
<?php | ||
class MyStream { | ||
function stream_open() { | ||
return true; | ||
} | ||
function stream_stat() { | ||
return false; | ||
} | ||
function stream_read() { | ||
return new stdClass; | ||
} | ||
} | ||
stream_wrapper_register('mystream', MyStream::class); | ||
try { | ||
var_dump(file_get_contents('mystream://')); | ||
} catch (Error $e) { | ||
echo $e->getMessage(), "\n"; | ||
} | ||
?> | ||
--EXPECT-- | ||
Object of class stdClass could not be converted to string |
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