Uh oh!
There was an error while loading. Please reload this page.
fix(previews): Stop returning true when getimagesize() fails - #46342
Merged
Conversation
joshtrichards
commented
Jul 6, 2024
MemberAuthor
/backport to stable29 |
joshtrichards
commented
Jul 6, 2024
MemberAuthor
Thinking more about this, we should probably just use the suppressor and not over-use these other methods... |
artonge
reviewed
Jul 8, 2024
Uh oh!
There was an error while loading. Please reload this page.
joshtrichardsforce-pushed
the
fix-getimagesize
branch
from
July 14, 2024 13:53
71c1e63 to
69cf936Compare
This comment was marked as outdated.
This comment was marked as outdated.
joshtrichardsforce-pushed
the
fix-getimagesize
branch
from
July 15, 2024 20:26
69cf936 to
2dd39d2CompareSigned-off-by: Josh Richards <josh.t.richards@gmail.com>
joshtrichardsforce-pushed
the
fix-getimagesize
branch
from
July 16, 2024 01:06
2dd39d2 to
c0e1503Compareartonge
approved these changes
Jul 16, 2024
skjnldsv
approved these changes
Jul 16, 2024
Merged
7 tasks
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 freeto 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.
Summary
Our
checkImageSize()&checkImageDataSize()methods always returntrueif an image is corrupt/invalid1 (or unreadable). However, whengetimagesize()returnsfalseso shouldcheckImage*()IMO.This current behavior causes already detected invalid images to not only bypass the
checkImageMemory()check (as intended), but to continue to be processed in other ways even though they'll fail.This impacts all formats, not just jpeg (though most are covered by suppressors at this point).
One could argue the current situation is valid behavior since the intention of the
checkImage*methods isn't to detect other types of image problems, so it's a bit of an overloaded use. But in all cases I can conceive of, other image manipulations are going to fail anyhow ifgetimagesize()does. And we're immediately callinggetimagesize()once again in many cases.P.S. With the fix to
checkImageSize(), the line with the suppressor shouldn't even be executed any longer. The suppressor added here is just for good measure and to be consistent with the other image formats. If the behavior of thecheckImage*()methods is desired to be retained as-is, I can eliminate those changes and keep only the suppressor.TODO
Checklist
Footnotes
(or at least corrupt enough their image data can't be retrieved by gd) ↩