Skip to content

Flush pending bit fields across empty nested parsers - #363

Open
Aschenbath wants to merge 1 commit into
keichi:masterfrom
Aschenbath:fix/oss10-20261124-9130-binary-empty-nest-bits
Open

Aschenbath wants to merge 1 commit into
keichi:masterfrom
Aschenbath:fix/oss10-20261124-9130-binary-empty-nest-bits

Conversation

@Aschenbath

Copy link
Copy Markdown
Contributor

A bit field followed by an empty nested Parser can disappear from the result. For example, bit4("value").nest("empty", {type: new Parser()}).uint8("tail") reads tail from the first byte and never assigns value.

Look past empty nests when deciding whether the next field continues a packed bit group. This flushes pending bits before a byte field or EOF while preserving packing when another bit field follows. Add regressions for EOF, consecutive empty nests followed by a byte, and a bit group spanning an empty nest.

Validation: the regression reproduces on master; 262 Node tests and 130 Chromium tests passed (one existing browser skip). TypeScript build, type-aware lint and format checks passed on Node 24 / Windows.

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