Skip to content

fix: reject streams ending with incomplete records - #300

Open
HocVoNgThai wants to merge 1 commit into
msgpack:mainfrom
HocVoNgThai:fix/reject-incomplete-streams
Open

HocVoNgThai wants to merge 1 commit into
msgpack:mainfrom
HocVoNgThai:fix/reject-incomplete-streams

Conversation

@HocVoNgThai

Copy link
Copy Markdown

Check for remaining array items, a pending value header or an unfinished container when an async decoding stream ends. Throw RangeError instead of reporting successful completion with missing records.

For example, a stream containing [{ id: 1 }, { id: 2 }] with its last byte missing currently finishes and returns only { id: 1 }. With this change, it still yields the complete first item, then rejects when it detects that the second item is incomplete. Complete streams retain their current behavior.

Adds regressions for array streams missing a whole item or part of its value, plus multi-record streams ending inside a string or nested object.

Closes #299

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.

Stream decoders silently accept incomplete final records

1 participant