Skip to content

Fix panic on malformed LCM packets#1230

Open
mohammadmseet-hue wants to merge 1 commit intogoogle:masterfrom
mohammadmseet-hue:fix-lcm-panic
Open

Fix panic on malformed LCM packets#1230
mohammadmseet-hue wants to merge 1 commit intogoogle:masterfrom
mohammadmseet-hue:fix-lcm-panic

Conversation

@mohammadmseet-hue
Copy link
Copy Markdown

Summary

Add bounds checking in LCM.DecodeFromBytes for fragmented header fields and fingerprint read.

Root cause: Fragmented LCM packets read 12 additional bytes (PayloadSize, FragmentOffset, FragmentNumber, TotalFragments) after the initial 8-byte check, but the minimum check only validates 8 bytes. After the channel name loop, the fingerprint read accesses data[offset:offset+8] without bounds checking.

Fix: Check len(data) >= 20 for fragmented headers. Check offset+8 <= len(data) before fingerprint read.

All existing tests pass.

Add bounds checking for fragmented LCM header fields and fingerprint
read. Malformed packets with truncated fragmented headers or missing
fingerprint data caused slice bounds panics.
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