Repository navigation
decoder: Do not report stale reinit dimensions for too small sequences - #40
Merged
Merged
Conversation
When a sequence is larger than the create-time maximum, impeg2d_dec_seq_hdr() returns IMPEG2D_UNSUPPORTED_DIMENSIONS and stores its size in u2_reinit_max_width/height, which the decode call reports as u4_pic_wd/ht so that the application can create a decoder of that size. The branches that reject a width or height below MIN_WIDTH/MIN_HEIGHT return the same error without writing these fields, so a decoder that had earlier seen an oversized sequence reported that sequence's size for the too small one (before or after IVD_CMD_CTL_RESET, which does not clear the fields either). A new decoder reports 0x0. Clear the reinit dimensions in the two too-small branches.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
harishdm
approved these changes
Nov 20, 2026
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.
When a sequence is larger than the create-time maximum,
impeg2d_dec_seq_hdr()returnsIMPEG2D_UNSUPPORTED_DIMENSIONSand stores its size inu2_reinit_max_width/height, which the decode call reports asu4_pic_wd/htso that the application can create a decoder of that size. The two branches that reject a width or height belowMIN_WIDTH/MIN_HEIGHTreturn the same error without writing these fields.So a decoder that has seen an oversized sequence reports that sequence's size for a later, too small one: with a 176x144 decoder, after a 352x288 sequence, a sequence 8 pixels wide is rejected with
u4_pic_wd/ht352x288; a new decoder reports 0x0.IVD_CMD_CTL_RESETdoes not clear the fields, so the same happens after a reset (the fuzzer resets onIMPEG2D_UNSUPPORTED_DIMENSIONSand reallocates its frame from the reported size).This change clears the reinit dimensions in the two too-small branches, which is what a new decoder reports.
Tested on
main(275c536) with clang 21 and AddressSanitizer: after the oversized sequence, with or without a reset, the too small sequence now reports 0x0 like a new decoder (352x288 before). The program and the streams are in this gist: https://gist.github.com/GeekQAQ/f3806a8a1a18633cc510ceae8b85d201 The default CMake build (Release, gcc and clang) has no new warnings, andmpeg2decgives byte-identical output before and after the change on 16 short test streams with 1 core, and with 4 cores except for a stream that starts with a B picture, whose 4-core output already varies from run to run onmain(a separate issue, sent as its own PR).