Skip to content

Prevent ResumableParser from stalling on invalid object keys - #1086

Merged
byroot merged 1 commit into
ruby:masterfrom
ydah:fix-resumable-invalid-key
Oct 1, 2026
Merged

byroot merged 1 commit into
ruby:masterfrom
ydah:fix-resumable-invalid-key

Conversation

@ydah

@ydah ydah commented Oct 1, 2026

Copy link
Copy Markdown
Member

A backslash followed by a literal NUL in an object key makes ResumableParser keep returning false, even after more input arrives.

require "json"

parser = JSON::ResumableParser.new
parser << "{\"key\\\x00\":1}"
parser.parse
# Before: false on every retry
# After: raises JSON::ParserError

Only rewind and wait when the cursor has reached the end of input, matching string-value parsing.

@byroot
byroot merged commit 452f31b into ruby:master Oct 1, 2026
42 checks passed
@ydah
ydah deleted the fix-resumable-invalid-key branch October 1, 2026 06:24
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.

2 participants