Skip to content

Fix bgcode-mangle CRC byte overflow - #5367

Open
Old-Ding wants to merge 1 commit into
prusa3d:masterfrom
Old-Ding:codex/bgcode-mangle-crc-wrap
Open

Fix bgcode-mangle CRC byte overflow#5367
Old-Ding wants to merge 1 commit into
prusa3d:masterfrom
Old-Ding:codex/bgcode-mangle-crc-wrap

Conversation

@Old-Ding

@Old-Ding Old-Ding commented Jul 5, 2026

Copy link
Copy Markdown

Summary

  • use wrapping arithmetic when bgcode-mangle -k corrupts CRC bytes
  • add a CLI regression test covering a CRC that contains 0xff

Testing

  • reproduced the original debug panic with a one-block bgcode file whose CRC bytes include 0xff
  • cargo test and cargo test --release (unit and CLI regression tests passed)
  • cargo clippy --all-targets -- -D warnings
  • git diff --check
  • rustfmt --check still reports pre-existing formatting drift in utils/bgcode-mangle/src/main.rs; unrelated lines remain unchanged

Use wrapping arithmetic when corrupting CRC bytes so 0xff values do not panic in debug builds.

Generated-by: OpenAI Codex
Signed-off-by: Old Ding <35417409+Old-Ding@users.noreply.github.com>
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.

1 participant