Repository navigation
Guard against encoding more items than the 16-bit item ID space allows - #3352
Open
krishna28238-arch wants to merge 4 commits into
Open
krishna28238-arch wants to merge 4 commits into
krishna28238-arch wants to merge 4 commits into
Conversation
avifEncoderAddImageItems() now refuses to create items that would overflow the unsigned int(16) item IDs written in the 'pitm', 'iloc', 'infe', 'iref' and 'ipma' boxes (item ID 0 is invalid, see ISO/IEC 14496-12 Section 8.11.1.1), instead of silently wrapping the lastItemID counter and generating an invalid file. A color grid and an alpha grid of 128x256 cells each for example need 65538 distinct item IDs. Part of AOMediaCodec#3337.
Keeps the end of avifgridapitest.cc identical to the merge base so that merging main (which appends the CellsTooManyForDimgReferenceCount test from AOMediaCodec#3354 there) does not conflict.
…limit avifEncoderDataCreateItem() now returns AVIF_RESULT_NOT_IMPLEMENTED when there is no unsigned int(16) item ID left, as a safety net for the item creation paths that are not covered by the upfront check in avifEncoderAddImageItems() (metadata items, gain maps...). To let the error code be properly propagated, the function now returns an avifResult through an out-pointer instead of NULL on failure. This also fixes latent NULL-dereferences on allocation failure at the avifEncoderAddImageItems(), avifEncoderCreateBitDepthExtensionItems() and avifEncoderAddImageInternal() call sites, which did not check for NULL. Follows the review of AOMediaCodec#3353.
krishna28238-arch
force-pushed
the
fix-item-count-guard
branch
from
September 10, 2026 12:47
c67a0a4 to
3c48e16
Compare
… avifsvttest.exe)
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.
avifEncoderAddImageItems() now refuses to create items that would overflow the unsigned int(16) item IDs written in the 'pitm', 'iloc', 'infe', 'iref' and 'ipma' boxes (item ID 0 is invalid, see ISO/IEC 14496-12 Section 8.11.1.1), instead of silently wrapping the lastItemID counter and generating an invalid file. A color grid and an alpha grid of 128x256 cells each for example need 65538 distinct item IDs.
Part of #3337.