Repository navigation
Conversation
iliaal
reviewed
Dec 1, 2026
iliaal
left a comment
Member
There was a problem hiding this comment.
This changes what getimagesize() returns for a truncated header that has been accepted for years, with no crash or memory issue behind it, so please retarget to master.
| . str_repeat("\0", 24) | ||
| . pack('n', 3); | ||
| var_dump(getimagesizefromstring($jpc)); | ||
| var_dump(getimagesizefromstring($jpc . "\x07\x01\x01\x07\x01")); |
Member
There was a problem hiding this comment.
Please also add a complete header with different bit depths per component, e.g. "\x07\x01\x01\x0B\x01\x01\x07\x01\x01" (expected bits 12, channels 3). That pins the 3-byte stride and the highest-depth selection, which the two rejection cases don't exercise.
This was referenced Dec 1, 2026
Contributor
Author
|
Retargeted to master and added the mixed bit depth case in d364d4b. |
iliaal
approved these changes
Dec 1, 2026
iliaal
left a comment
Member
There was a problem hiding this comment.
Please squash into one commit and add a NEWS entry.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
php_handle_jpc()loops overCsizcomponent descriptors with uncheckedphp_stream_getc()calls, so a codestream cut off before those bytes still returns an image withCsizchannels. Each 3-byte descriptor is now read in one go and a short read makesgetimagesize()return false.Fixes #25960