Skip to content

fix: advance the cursor after reading buffers and wrappers to EOF - #358

Open
Aschenbath wants to merge 2 commits into
keichi:masterfrom
Aschenbath:fix/oss20-20261124-04c7-binary-parser-buffer-eof
Open

Aschenbath wants to merge 2 commits into
keichi:masterfrom
Aschenbath:fix/oss20-20261124-04c7-binary-parser-buffer-eof

Conversation

@Aschenbath

@Aschenbath Aschenbath commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Fields with readUntil: "eof" return the remaining bytes without advancing the parser cursor, both for buffer and wrapped. A following saveOffset reports the old offset, later fields can reread consumed data, and an enclosing EOF array throws "Array element did not consume any bytes".

Advance the cursor to the active input length after taking the remaining slice. Wrapped fields save that position before switching to the transformed buffer, so the restored outer offset tracks consumed input even when the wrapper changes the data length.

Regression tests cover Buffer and Uint8Array, nonzero view offsets, empty remainders, cloned EOF fields in arrays, transformed inner/outer offsets, and bounds errors after EOF. Six original buffer cases and four added wrapper cases fail before their respective fixes.

Validation: all 266 Node tests, TypeScript build, type-aware lint, formatting, and git diff --check pass. Browser tests were not run locally; the earlier buffer-only revision passed the upstream browser, Node, Bun, and Deno jobs.

@Aschenbath Aschenbath changed the title fix: advance the cursor after reading a buffer to EOF fix: advance the cursor after reading buffers and wrappers to EOF Nov 24, 2026
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