Skip to content

Reject array elements that exceed their byte-length boundary - #365

Open
Aschenbath wants to merge 1 commit into
keichi:masterfrom
Aschenbath:fix/oss10-20261124-9130-binary-byte-array-boundary
Open

Aschenbath wants to merge 1 commit into
keichi:masterfrom
Aschenbath:fix/oss10-20261124-9130-binary-byte-array-boundary

Conversation

@Aschenbath

Copy link
Copy Markdown
Contributor

An array with lengthInBytes: 3 and uint16 elements currently parses two elements and consumes four bytes. Variable-size Parser elements can similarly consume bytes belonging to the following field.

Reject an element whose final offset exceeds the byte boundary computed for the array. Keep exact-boundary arrays valid and preserve readUntil precedence. Regressions cover primitives, inline and aliased variable-size elements, and a trailing field; six cases fail before the fix.

Validation on Node 24 / Windows: 266 Node tests and 132 Chromium tests passed (one existing browser skip). TypeScript build, type-aware lint and format checks passed.

This addresses logical lengthInBytes boundaries; #300 addresses count-based lengths larger than the remaining input.

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