Skip to content

fix: CRC placement in frame send indexes past data array bounds - #18

Merged
aq1018 merged 1 commit into
mainfrom
fix/frame-crc-placement
Apr 13, 2026
Merged

aq1018 merged 1 commit into
mainfrom
fix/frame-crc-placement

Conversation

@aq1018

@aq1018 aq1018 commented Apr 13, 2026

Copy link
Copy Markdown
Collaborator

Frame::send() places the CRC after the payload by indexing into data.raw[len] and data.raw[len+1]. data.raw is [u8; 64], so when len == MAX_PAYLOAD (64), index 64 is past the array. This is caused a panic during testing.

The fix uses struct-relative pointer math from the Frame base, which is valid for all payload sizes since Frame is #[repr(C)] and the crc field immediately follows data.

Still hacky for sure, but it doesn't cause panic.

@aq1018
aq1018 merged commit 206747f into main Apr 13, 2026
6 checks passed
@aq1018
aq1018 deleted the fix/frame-crc-placement branch April 18, 2026 02:26
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