Skip to content

Fix nesting too deep - #401

Open
stringhandler wants to merge 1 commit into
BlockstreamResearch:masterfrom
stringhandler:st-nesting-too-deep
Open

Fix nesting too deep#401
stringhandler wants to merge 1 commit into
BlockstreamResearch:masterfrom
stringhandler:st-nesting-too-deep

Conversation

@stringhandler

Copy link
Copy Markdown
Contributor

Fixes #399.

Deeply nested input overflowed the stack and aborted the process instead of producing an error, making any service that compiles .simf files trivially killable.

@apoelstra

Copy link
Copy Markdown
Contributor

lmao debug builds are using 80kb of stack per frame? I think we need to fix that.

A recursion depth limit of 16 is far too low. I'd prefer no limit at all. Is the recursion inherent to chumsky or can we fix it within our own code.

@stringhandler

Copy link
Copy Markdown
Contributor Author

Yeah, this is a concerning bug though, as wallets will potentially be compiling code. I agree that 16 is too low. Let me dig in and see if I can find out what is taking up so much space.

@apoelstra

Copy link
Copy Markdown
Contributor

The compiler shouldn't be recursing here. In Expression::parser we take pains to pass the expr variable into the sub-parsers and use that rather than calling Expression::parser again.

We should investigate where the actual stack overflow comes from.

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.

Recursive Parser has no limit, leading to stack overflow on deeply nested inputs

2 participants