use size_t for image plane allocation in alloc_image#635
Merged
solidpixel merged 2 commits intoJun 3, 2026
Conversation
Contributor
|
Good spot, thank you. |
solidpixel
approved these changes
Jun 3, 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.
alloc_image sizes each plane with dim_x * dim_y * 4 evaluated as unsigned int, but those dimensions come straight from a .astc or .ktx header, so a 32768x32768 image wraps the multiply and allocates a 0 byte plane. The decompressor then writes the full 4dim_xdim_y extent with size_t indexing in store_image_block and runs off the end of the buffer. I hit this reading the alloc path after the recent surface-size fixes: the KTX and DDS loaders check the size in 64-bit but the allocation here was still 32-bit, and the decompress output path has no guard at all. Widen the multiply to size_t so the buffer matches what gets written.