-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Stack overflow when opening many blocks #15241
Copy link
Copy link
Open
Labels
A:parserIssues related to parsingIssues related to parsingpanicperformanceWork to make nushell quicker and use less resourcesWork to make nushell quicker and use less resourcesstatus:needs-triageAn issue that hasn't had any proper lookAn issue that hasn't had any proper look
Description
Describe the bug
Our parser is sensitive to inputs causing excessive recursion.
E.g. opening but never closing many blocks causes a stack overflow.
How to reproduce
In the REPL (thanks to the syntax highlight parsing pass) or a script open many blocks through {
Expected behavior
While tricky to guard against, for the most likely and egregious cases we may want to consider a recursion limit to fail gracefully in our parser.
And if possible it may be worth rewriting parts of the parsing logic to avoid growing the call stack when given malformed input. (This could be a DoS concern for nuon)
Configuration
| key | value |
|---|---|
| version | 0.102.1 |
| major | 0 |
| minor | 102 |
| patch | 1 |
| branch | main |
| commit_hash | be508cb |
| build_os | linux-x86_64 |
| build_target | x86_64-unknown-linux-gnu |
| rust_version | rustc 1.83.0 (90b35a623 2024-11-26) |
| rust_channel | 1.83.0-x86_64-unknown-linux-gnu |
| cargo_version | cargo 1.83.0 (5ffbef321 2024-10-29) |
| build_time | 2025-02-26 12:08:07 +01:00 |
| build_rust_channel | debug |
| allocator | mimalloc |
| features | default, sqlite, trash |
| installed_plugins | formats 0.99.2 |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A:parserIssues related to parsingIssues related to parsingpanicperformanceWork to make nushell quicker and use less resourcesWork to make nushell quicker and use less resourcesstatus:needs-triageAn issue that hasn't had any proper lookAn issue that hasn't had any proper look
