Fix u16 overflow in 2-bit and 4-bit bitmap decoders#76
Merged
Conversation
The index calculations (y * scan_width + x) were done in u16 arithmetic, causing overflow panics for bitmaps where the product exceeds 65535. Cast to usize before multiplying, matching the existing fix in the 1-bit decoder. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
igorlira
approved these changes
Mar 14, 2026
Owner
|
Looks good with the movies I tested :) |
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.
Summary
decode_bitmap_2bitanddecode_bitmap_4bitwhen index calculations (y * scan_width + x) exceed u16 max (65535)usizebefore multiplying, matching the existing fix indecode_bitmap_1bitTest plan
worldbuilder.dcr) loads and renders correctly after fix🤖 Generated with Claude Code