Skip to content

fix: decode indexed PixMaps in PICT BitsRect opcodes - #617

Closed
benletchford wants to merge 1 commit into
masterfrom
dev/decode-indexed-pict-bitsrect
Closed

fix: decode indexed PixMaps in PICT BitsRect opcodes#617
benletchford wants to merge 1 commit into
masterfrom
dev/decode-indexed-pict-bitsrect

Conversation

@benletchford

Copy link
Copy Markdown
Owner

Summary

  • decode indexed PixMap forms of PICT BitsRect and BitsRgn opcodes
  • preserve inline color tables for destination palette mapping
  • recognize the same form while scanning and measuring PICT streams
  • stop safely when a reserved opcode declares an overflowing payload length

Root cause

BitsRect and BitsRgn were always parsed as one-bit BitMaps. PICT v2 also permits an indexed PixMap when the high bit of rowBytes is set, so the decoder skipped the PixMap header and color table and then interpreted image bytes as later opcodes.

Validation

  • cargo fmt --check
  • cargo test --lib trap::pict::tests (31 passed)
  • regression coverage for an unpacked indexed PixMap BitsRect
  • regression coverage for reserved-opcode length overflow

Closes #606

@benletchford

Copy link
Copy Markdown
Owner Author

Superseded by #607, which preserves the general unpacked BitsRect path and now also includes bounded opcode scanning and stream-synchronization coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Decode unpacked indexed PixMaps in PICT BitsRect opcodes

1 participant