Repository navigation
Enforce dimension limits in TiffDecoder and AvifDecoder set_limits - #3133
Open
tanjiroK-coder wants to merge 1 commit into
Open
tanjiroK-coder wants to merge 1 commit into
tanjiroK-coder wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
TiffDecoder::set_limitsreads the image dimensions fromself.info, but that field is only populated onceprepare_imagehas run. In the order theImageDecoderprotocol documents, and the orderImageReaderOptions::into_decoderuses,set_limitsruns first, so it checked a placeholder of 0x0 and strictmax_image_width/max_image_heightlimits were silently accepted for any TIFF;ImageReader::decodeis unaffected because it re-checks the layout, but a decoder handed toDynamicImage::from_decoderdecodes at full size. This is a regression from the decoder refactor in e6a182c, which replaced the previousself.dimensions()call with the dummy and adjusted the test to callprepare_imagebeforeset_limits.AvifDecoder::set_limitshas the same gap in a simpler form: it stores the limits without callingcheck_supportorcheck_dimensions. Both now look up the real layout the way the trait default and the other decoders do. Theprepare_imageworkaround intests/limits.rsis removed, so the existingtiffandavifassertions fail on main and pass with this change (theaviftest only runs withavif-native, which I built locally via the internal dav1d build).