Skip to content

Bug: input panics due to overflow #18

@fusetim

Description

@fusetim

What happened?
When using an input and scrolling through the columns (tested only in Movie Editor, with the plot field), it panics (not every time).

Seems that it has been introduced by 90521bd

Trace:

{"backtrace":"   0: structured_logger::log_panic\n             at /home/fusetim/.cargo/registry/src/index.crates.io-6f17d22bba15001f/structured-logger-1.0.2/src/lib.rs:445:21\n   1: core::ops::function::Fn::call\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/ops/function.rs:79:5\n   2: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/boxed.rs:1987:9\n   3: std::panicking::rust_panic_with_hook\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:695:13\n   4: std::panicking::begin_panic_handler::{{closure}}\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:582:13\n   5: std::sys_common::backtrace::__rust_end_short_backtrace\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/sys_common/backtrace.rs:150:18\n   6: rust_begin_unwind\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:578:5\n   7: core::panicking::panic_fmt\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/panicking.rs:67:14\n   8: core::panicking::panic_bounds_check\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/panicking.rs:162:5\n   9: <usize as core::slice::index::SliceIndex<[T]>>::index\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/slice/index.rs:261:10\n  10: core::slice::index::<impl core::ops::index::Index<I> for [T]>::index\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/slice/index.rs:19:9\n  11: <alloc::vec::Vec<T,A> as core::ops::index::Index<I>>::index\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/vec/mod.rs:2691:9\n  12: mkube::views::widgets::input::Input::render_text\n             at ./src/views/widgets/input.rs:218:37\n  13: <mkube::views::movie_manager::editor::MovieEditor as tui::widgets::StatefulWidget>::render::{{closure}}\n             at ./src/views/movie_manager/editor.rs:88:40\n  14: core::iter::adapters::map::map_fold::{{closure}}\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/adapters/map.rs:84:28\n  15: <core::iter::adapters::enumerate::Enumerate<I> as core::iter::traits::iterator::Iterator>::fold::enumerate::{{closure}}\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/adapters/enumerate.rs:107:27\n  16: core::iter::traits::iterator::Iterator::fold\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/traits/iterator.rs:2482:21\n  17: <core::iter::adapters::enumerate::Enumerate<I> as core::iter::traits::iterator::Iterator>::fold\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/adapters/enumerate.rs:113:9\n  18: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/adapters/map.rs:124:9\n  19: core::iter::traits::iterator::Iterator::for_each\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/traits/iterator.rs:857:9\n  20: alloc::vec::Vec<T,A>::extend_trusted\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/vec/mod.rs:2844:17\n  21: <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/vec/spec_extend.rs:26:9\n  22: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/vec/spec_from_iter_nested.rs:62:9\n  23: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/vec/spec_from_iter.rs:33:9\n  24: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/vec/mod.rs:2712:9\n  25: core::iter::traits::iterator::Iterator::collect\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/iter/traits/iterator.rs:1896:9\n  26: <mkube::views::movie_manager::editor::MovieEditor as tui::widgets::StatefulWidget>::render\n             at ./src/views/movie_manager/editor.rs:77:30\n  27: <mkube::views::movie_manager::MovieManager as tui::widgets::StatefulWidget>::render\n             at ./src/views/movie_manager/mod.rs:66:17\n  28: <mkube::views::App as tui::widgets::StatefulWidget>::render\n             at ./src/views/mod.rs:193:17\n  29: tui::terminal::Frame<B>::render_stateful_widget\n             at /home/fusetim/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tui-0.19.0/src/terminal.rs:133:9\n  30: mkube::run::{{closure}}::{{closure}}\n             at ./src/main.rs:231:21\n  31: tui::terminal::Terminal<B>::draw\n             at /home/fusetim/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tui-0.19.0/src/terminal.rs:263:9\n  32: mkube::run::{{closure}}\n             at ./src/main.rs:229:17\n  33: mkube::main::{{closure}}\n             at ./src/main.rs:47:29\n  34: tokio::runtime::park::CachedParkThread::block_on::{{closure}}\n             at /home/fusetim/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/park.rs:283:63\n  35: tokio::runtime::coop::with_budget\n             at /home/fusetim/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/coop.rs:107:5\n  36: tokio::runtime::coop::budget\n             at /home/fusetim/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/coop.rs:73:5\n  37: tokio::runtime::park::CachedParkThread::block_on\n             at /home/fusetim/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/park.rs:283:31\n  38: tokio::runtime::context::blocking::BlockingRegionGuard::block_on\n             at /home/fusetim/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/context/blocking.rs:66:9\n  39: tokio::runtime::scheduler::multi_thread::MultiThread::block_on::{{closure}}\n             at /home/fusetim/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/scheduler/multi_thread/mod.rs:87:13\n  40: tokio::runtime::context::runtime::enter_runtime\n             at /home/fusetim/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/context/runtime.rs:65:16\n  41: tokio::runtime::scheduler::multi_thread::MultiThread::block_on\n             at /home/fusetim/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/scheduler/multi_thread/mod.rs:86:9\n  42: tokio::runtime::runtime::Runtime::block_on\n             at /home/fusetim/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.29.1/src/runtime/runtime.rs:313:45\n  43: mkube::main\n             at ./src/main.rs:67:5\n  44: core::ops::function::FnOnce::call_once\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/ops/function.rs:250:5\n  45: std::sys_common::backtrace::__rust_begin_short_backtrace\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/sys_common/backtrace.rs:134:18\n  46: std::rt::lang_start::{{closure}}\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/rt.rs:166:18\n  47: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/ops/function.rs:287:13\n  48: std::panicking::try::do_call\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:485:40\n  49: std::panicking::try\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:449:19\n  50: std::panic::catch_unwind\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panic.rs:140:14\n  51: std::rt::lang_start_internal::{{closure}}\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/rt.rs:148:48\n  52: std::panicking::try::do_call\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:485:40\n  53: std::panicking::try\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:449:19\n  54: std::panic::catch_unwind\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panic.rs:140:14\n  55: std::rt::lang_start_internal\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/rt.rs:148:20\n  56: std::rt::lang_start\n             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/rt.rs:165:17\n  57: main\n  58: <unknown>\n  59: __libc_start_main\n  60: _start\n","file":"src/views/widgets/input.rs","level":"ERROR","line":218,"message":"thread 'main' panicked at 'index out of bounds: the len is 103 but the index is 103', src/views/widgets/input.rs:218:37","target":"panic","thread_name":"main","timestamp":1692116948151}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions