Repository navigation
deps: parser v0.13.0, which bounds nested source instead of crashing on it - #796
Merged
Merged
Conversation
…on it main was on parser v0.11.1, so rbgo did NOT have the nesting limit even though it merged upstream two days ago. Deeply nested source still overflowed the Go stack here -- a fatal runtime error, not a panic, so recover() cannot contain it and the process dies. run.go calls parser.Parse as its FIRST statement, so a host that merely compiles untrusted Ruby was exposed without executing it. Worth saying why it was missed: parser v0.12.0 existed and looked like the newest release, but it was cut BEFORE the fix. `compare v0.11.1...v0.12.0` contains one commit, "build: raise the Go floor to 1.27.1", and nothing else; the nesting fix sat on the parser's main, one commit past that tag, untagged. A higher tag number is not the same as newer code. Tagged v0.13.0 for this. Measured through rbgo, with `x = ` + `f(`*N: depth 20000 60 KB parse error: nesting of 32769 is too deep exit 1 depth 70000 210 KB parse error: nesting of 32769 is too deep exit 1 depth 100000 300 KB parse error: nesting of 32769 is too deep exit 1 main, depth 100000 fatal error: stack overflow exit 2 20000 errors because `f(` is a 2x production -- 20000 levels is 40001 frames, past the 32768 ceiling. That is still well above anything MRI accepts: MRI refuses `f(`*8000 already, with a Prism SyntaxError. So nothing MRI would have parsed is newly rejected. Full suite green (internal/vm 206s), gofmt and vet clean. Refs go-ruby-parser/parser#48, #768. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mainwas on parser v0.11.1, so rbgo did not have the nesting limit even though it merged upstream two days ago. Deeply nested source still overflowed the Go stack here — a fatal runtime error, not a panic, sorecover()cannot contain it and the process dies.run.gocallsparser.Parseas its first statement, so a host that merely compiles untrusted Ruby was exposed without ever executing it.Why it was missed, which is the part worth recording
Parser v0.12.0 existed and looked like the newest release. It was cut before the fix:
v0.11.1...v0.12.0contains one commit — "build: raise the Go floor to 1.27.1" — and nothing else. A higher tag number is not the same as newer code, and the fix sat on the parser'smain, one commit past that tag, untagged. Tagged v0.13.0 for this bump.Measured through rbgo, before and after
x =+f(×N:mainparse error: nesting of 32769 is too deep, exit 1fatal error: stack overflow, exit 220 000 errors because
f(is a 2× production — 20 000 levels is 40 001 frames, past the 32 768 ceiling. That is still well above anything MRI accepts: MRI refusesf(×8000 already, with a PrismSyntaxError. So nothing MRI would have parsed is newly rejected, which is the bound that matters.Verified
Full suite green (
internal/vm206 s),gofmt -lempty,go vetclean.Refs go-ruby-parser/parser#48 and #768 — this closes the parser half of that issue for rbgo. The VM half (a frame count cannot bound the Go stack against unbounded native dispatch nesting; ~33 layers reopen it) stays open on #768.
🤖 Generated with Claude Code