Skip to content

Fix JSON::ResumableParser#parse leaking the in_use lock on an empty buffer#1017

Merged
byroot merged 1 commit into
ruby:masterfrom
mame:fix-parse-in-use-leak
Jun 18, 2026
Merged

Fix JSON::ResumableParser#parse leaking the in_use lock on an empty buffer#1017
byroot merged 1 commit into
ruby:masterfrom
mame:fix-parse-in-use-leak

Conversation

@mame

@mame mame commented Jun 18, 2026

Copy link
Copy Markdown
Member

#parse sets in_use then returns early on an empty buffer without clearing it, permanently bricking the parser.

require "json"
parser = JSON::ResumableParser.new
parser.parse          # => false, but leaks in_use = true
parser << "[1,2,3]"
parser.parse          # ArgumentError: ResumableParser can't be used recursively

…uffer

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@byroot byroot merged commit 3927c5c into ruby:master Jun 18, 2026
42 checks passed
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