google / google/go-jsonnet

Parser crashes on deeply nested input

Open
#870 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.8k
Forks
263
PR merge metrics
No merged PRs in 30d

Description

Deeply nested Jsonnet input causes a stack overflow in the recursive descent
parser, since there is no depth limit on parse() calls.

```
python3 -c "print('(' * 100000 + '1' + ')' * 100000)" > crash.jsonnet
jsonnet crash.jsonnet
# fatal error: stack overflow
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the crash with the provided command and locate the recursive descent parser entry point where parse() calls accumulate. Trace how deeply nested Jsonnet input is handled, then add regression coverage for the 100,000-level case and verify that jsonnet no longer crashes with a stack overflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.