-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Description
Describe the bug
@syheliel reports the following errors:
1. arrow-datafusion/datafusion/physical-expr/src/[planner.rs:54](http://planner.rs:54/)
if &variable_names[0][0..2] == "@@" {
2. arrow-datafusion/datafusion/physical-expr/src/[planner.rs:1740](http://planner.rs:1740/)
if &var_names[0][0..1] == "@" {
Which will panic if the length of variable names is less than 2 characters.
These bugs can be fixed by using get(0..2) instead of [0..2] for a slice.
To Reproduce
Here is one reproducer:
❯ SELECT N | "". LT;
thread 'main' panicked at 'byte index 1 is out of bounds of ``', library/core/src/str/mod.rs:107:9
stack backtrace:
0: rust_begin_unwind
at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:584:5
1: core::panicking::panic_fmt
at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/panicking.rs:142:14
2: core::str::slice_error_fail_rt
at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/str/mod.rs:107:9
3: core::ops::function::FnOnce::call_once
at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/ops/function.rs:248:5
4: core::intrinsics::const_eval_select
at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/intrinsics.rs:2376:5
5: core::str::slice_error_fail
...Expected behavior
A valid error message rather than panic
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers