Skip to content
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

Stack overflow bug #66

Open
nathaniel-brough opened this issue Feb 21, 2023 · 2 comments
Open

Stack overflow bug #66

nathaniel-brough opened this issue Feb 21, 2023 · 2 comments

Comments

@nathaniel-brough
Copy link
Contributor

I found a bug in the starlark parser using the fuzzing harness in #64. I'm guessing there is some recursive parsing of unary operators and as a result, you can get a stackoverflow if you chain a bunch of unary operators. e.g. attempting to parse;

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++''

Will result in a stackoverflow. It looks like a fairly unlikely scenario, and likely won't impact usage much if at all. But I thought I'd mention it anyway :)

@ndmitchell
Copy link
Contributor

I took a look at this case - the issue is in ExprP::into_map_payload, which uses linear stack space in the size of the expression. I don't think there's much we can easily do to avoid that, without writing this (and probably a bunch of other traverals) as stack-free, which is a fair bit of work and more complexity, so I think we just have to accept it for now.

@ndmitchell
Copy link
Contributor

Going to leave this ticket for all overflows. One day we might want to harden against deep recursion in the AST, but for now I think it's considered expected.

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

No branches or pull requests

2 participants