fix: prevent uint32_t overflow in avifSetTileConfiguration tile area#3052
Open
uwezkhan wants to merge 2 commits intoAOMediaCodec:mainfrom
Open
fix: prevent uint32_t overflow in avifSetTileConfiguration tile area#3052uwezkhan wants to merge 2 commits intoAOMediaCodec:mainfrom
uwezkhan wants to merge 2 commits intoAOMediaCodec:mainfrom
Conversation
wantehchang
reviewed
Feb 22, 2026
…ame, and encoding structures.
Author
|
Thanks for the clarification. I’ve updated the implementation to use uint64_t for imageArea, safely cast the result back to uint32_t, and verified that the caller enforces width and height ≤ 65536. |
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.
fix: prevent uint32_t overflow in avifSetTileConfiguration tile area
When computing the tile count,
width * heightwas performed as auint32_t multiplication. For images with dimensions whose product
exceeds UINT32_MAX (e.g. 100000x50000), this silently wraps around,
producing an incorrect tile count and potentially corrupt tile layout.
Fix by widening to uint64_t before multiplying, and clamping to
kMaxTiles using AVIF_MIN before downcasting back to uint32_t.
The existing bounds checks are preserved as a safety net.
Fixes: integer overflow in avifSetTileConfiguration (src/write.c)