fix: decode unpacked indexed PICT pixmaps - #607
Open
benletchford wants to merge 2 commits into
Open
Conversation
benletchford
marked this pull request as ready for review
August 14, 2026 08:26
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.
Closes #606.
Root cause
The PICT decoder treated every
BitsRect/BitsRgnopcode as a 1-bitBitMap. Version 2 pictures can set the high bit ofrowBytesand supply an indexedPixMapwith a color table and unpacked pixel data. Reading that structure as a BitMap desynchronized the opcode stream; a later pixel word could then be interpreted as a reserved opcode with a huge length and overflow the parser position.Change
BitsRectandBitsRgn.PackBitsRectwhile readingBitsRectrows uncompressed.The implementation follows Inside Macintosh: Imaging With QuickDraw (1994), Appendix A, pp. A-13 and A-17.
Qualification
The checksum-pinned, pure-68K Falcon MC promotional demo now:
Before this change, startup panicked while decoding PICT 132 (
BitsRect,rowBytes=$8004, 4-bit indexed PixMap).Validation
cargo fmt --checkcargo test --lib: 2,950 passed, 3 ignoredcargo check --no-default-features: passed