Repository navigation
Reject iloc with total item size exceeding 16x file size - #3398
Open
littlepig12345 wants to merge 1 commit into
Open
littlepig12345 wants to merge 1 commit into
littlepig12345 wants to merge 1 commit into
Conversation
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.
avifDecoderParse() trusts the sum of item sizes declared in iloc. Multiple items can point at the same extent, so N items pointing at the same L-byte region cause N * L bytes to be allocated. A small file can therefore trigger a disproportionate allocation.
Test results:
Before the patch:
After the patch:
The check compares the total declared item size against the file size, regardless of how the amplification is constructed.
Overlapping extents are allowed by ISO/IEC 14496-12 but are not supported by libavif for allocation purposes, so the check returns AVIF_RESULT_NOT_IMPLEMENTED.
This follows up on the overlapping extents case mentioned by @y-guyon in #3375.