-
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 #71848: getimagesize with $imageinfo returns false
Some JFIF images contain empty APP segments, i.e. those which consist only of the marker bytes and the length, but without actual content. It appears to be doubtful to have empty APP segments, but we should apply the robustness principle, and accept these, instead of simply failing in this case. We choose to add empty APP segments to $imageinfo with an empty string as value, instead of NULL, or even to omit these segments altogether. This patch also fixes the potential issue that php_stream_read() might not read the supposed number of bytes, which could result in garbage to be added to the read value.
- Loading branch information
Showing
4 changed files
with
34 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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,32 @@ | ||
--TEST-- | ||
Bug #71848 (getimagesize with $imageinfo returns false) | ||
--FILE-- | ||
<?php | ||
var_dump(getimagesize(__DIR__ . '/bug71848.jpg', $info)); | ||
var_dump(array_keys($info)); | ||
?> | ||
===DONE=== | ||
--EXPECT-- | ||
array(7) { | ||
[0]=> | ||
int(8) | ||
[1]=> | ||
int(8) | ||
[2]=> | ||
int(2) | ||
[3]=> | ||
string(20) "width="8" height="8"" | ||
["bits"]=> | ||
int(8) | ||
["channels"]=> | ||
int(3) | ||
["mime"]=> | ||
string(10) "image/jpeg" | ||
} | ||
array(2) { | ||
[0]=> | ||
string(4) "APP0" | ||
[1]=> | ||
string(4) "APP5" | ||
} | ||
===DONE=== |