Skip to content

Fix CCSDS maximum payload length decoding - #252

Open
sylvesterkaczmarek wants to merge 1 commit into
nasa:mainfrom
sylvesterkaczmarek:fix/248-payload-length-overflow
Open

sylvesterkaczmarek wants to merge 1 commit into
nasa:mainfrom
sylvesterkaczmarek:fix/248-payload-length-overflow

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown
Contributor

Fixes #248.

Widen PayloadLength so the valid CCSDS maximum data-field size of 65,536 octets is representable in memory. The wire format remains the 16-bit length count. This prevents 0xffff + 1 from wrapping to zero and makes truncated maximum-length packets fail with a short read as expected.

Adds boundary tests for 65,536-byte payloads, oversize lengths, truncated maximum-length packets, and complete maximum-length packets.

Validation:

  • go test ./pkg/...
  • git diff --check

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.

PayloadLength.Unmarshal overflows on length count 0xffff; truncated maximum-length packet accepted as complete

1 participant