-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Panic while parsing range #16185
Copy link
Copy link
Closed
Labels
A:parserIssues related to parsingIssues related to parsingcategory:bugSomething isn't workingSomething isn't workingpanicstatus:needs-triageAn issue that hasn't had any proper lookAn issue that hasn't had any proper look
Milestone
Description
Describe the bug
Parsing of ..=.. is highlighting problems with the range parsing logic.
Found via fuzzing of the nu-parser parse fuzz target.
How to reproduce
Enter ..=.. in the repl
├─▶ at /home/stefan/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/nu-protocol-0.105.1/src/engine/state_working_set.rs:400:48
╰─▶ slice index starts at 6 but ends at 5
0: 0x581c5325af0d - __rustc[4794b31dd7191200]::rust_begin_unwind
1: 0x581c522472d0 - core::panicking::panic_fmt::hc8737e8cca20a7c8
2: 0x581c52251127 - core::slice::index::slice_index_order_fail::do_panic::runtime::hfc089304f84e3e4f
3: 0x581c5224c6ea - core::slice::index::slice_index_order_fail::h262318a3b4cad0da
4: 0x581c52eaaf1b - nu_protocol::engine::state_working_set::StateWorkingSet::get_span_contents::h836ffced59f1c297
5: 0x581c52b3c4db - nu_parser::parser::parse_value::hf683f66e4c70767b
6: 0x581c52b2bd8f - nu_parser::parser::parse_range::he6173663a9e1e52a
7: 0x581c52b219c4 - nu_parser::parser::is_math_expression_like::hf6ee46ee8d03a2b9
8: 0x581c52b4313d - nu_parser::parser::parse_block::h9ea9fe5d6799e7e7
9: 0x581c52b46698 - nu_parser::parser::parse::h1da596ffa7d89fa5
10: 0x581c523e474c - <nu_cli::syntax_highlight::NuHighlighter as reedline::highlighter::Highlighter>::highlight::h6fe7467bdd4e7bdb
11: 0x581c530e0d29 - reedline::engine::Reedline::repaint::h3a65ba90dfcf8411
12: 0x581c530ddd64 - reedline::engine::Reedline::read_line::h519332261c30020a
13: 0x581c523caaa9 - nu_cli::repl::loop_iteration::hf0bf4935151618da
14: 0x581c523c3fb7 - std::panic::catch_unwind::h2db6ee0f81e1b738
15: 0x581c523b744a - nu_cli::repl::evaluate_repl::h72aeac48ecb40d29
16: 0x581c52390803 - nu::run::run_repl::h81423e03853f6010
17: 0x581c5236e669 - nu::main::hf304ef66cf1794b3
Expected behavior
No panic. either syntax error or if it would be more consistent with related behavior, downgrade to a string.
Configuration
| key | value |
|---|---|
| version | 0.105.1 |
| major | 0 |
| minor | 105 |
| patch | 1 |
| branch | |
| commit_hash | |
| build_os | linux-x86_64 |
| build_target | x86_64-unknown-linux-gnu |
| rust_version | rustc 1.88.0 (6b00bc388 2025-06-23) |
| rust_channel | stable-x86_64-unknown-linux-gnu |
| cargo_version | cargo 1.88.0 (873a06493 2025-05-10) |
| build_time | 2025-07-06 20:25:09 +02:00 |
| build_rust_channel | release |
| allocator | standard |
| features | default, sqlite, trash |
| installed_plugins | plotters 0.1.7+0.105.1 |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A:parserIssues related to parsingIssues related to parsingcategory:bugSomething isn't workingSomething isn't workingpanicstatus:needs-triageAn issue that hasn't had any proper lookAn issue that hasn't had any proper look