Skip to content

fix: bound zero-width collections and roundtrip map entries and polymorphic primitives - #42

Merged
rasros merged 2 commits into
mainfrom
fix/decoder-edge-cases
Oct 28, 2026
Merged

rasros merged 2 commits into
mainfrom
fix/decoder-edge-cases

Conversation

@rasros

@rasros rasros commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Fixes found in the 1.4.0 release audit. These bugs were already in v1.3.0. Encodings stay byte-identical to main.

  • Decoding could exhaust memory from a 5-byte input ([FF FF FF FF 07] as List<Unit>). The fix caps declared collection elements per decode at 8 × input bytes + 2^20, so nested lists can't multiply the limit.
  • Map.Entry didn't roundtrip: MapEntrySerializer opens a MAP via beginStructure, so no size was written. Such collections now write their own size.
  • A Boolean registered as a polymorphic subclass threw IllegalStateException. Polymorphic wrappers now give the subclass payload its own child encoder/decoder.
  • A huge string length could overflow the bounds check in decodeString.
  • README: states that the wire format is only stable between patch versions.

lintDocs check passes on JVM, JS, wasmJs, wasmWasi and linuxX64.

@rasros
rasros merged commit 03d8b56 into main Oct 28, 2026
1 check passed
@rasros
rasros deleted the fix/decoder-edge-cases branch October 28, 2026 13:03
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