-
Notifications
You must be signed in to change notification settings - Fork 62
feat: introduce maximum parser recursion depth #483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: introduce maximum parser recursion depth #483
Conversation
|
Better we can set this with the setting |
|
@He-Pin I implemented the fix, but let me know if I should remove some uses of |
|
@ronantakizawa I think so , we should not slow the parsing much. |
|
@He-Pin @stephenamar-db implemented feedback.
Previously it was used for 27 other methods.
|
|
Hi @lihaoyi, if I have time of course, I would appreciate if you could take a this PR. I'm trying to figure out if this is right way to implement maximum parse recursion depth with fastparse. |
|
@stephenamar-db the implementation looks fine. FastParse "rules" are just methods, so passing around a Only comment I would give is that I think a single |
|
@ronantakizawa climb method (line 270) - protects binary operator precedence climbing recursion This may not needed, I think the we should only limit where (), {}, [] nesting, not sure about the long binary operations |
Resolves issue #473.
This PR implements a configurable maximum parser recursion depth limit to prevent stack overflow from deeply
nested Jsonnet structures, following the approach from google/jsonnet#1230
Changes
Before:
overflow and crash the interpreter.
After:
crashing.
sjsonnet --max-parser-recursion-depth 2000 deeply_nested.jsonnet