cloudhead/rx

Crash while opening file/directory with unicode in name

neg4n opened this issue · 0 comments

neg4n commented

Description

rx crashes when opening directory (i guess it also occurs with opening single file) that contains unicode characters (or grapheme?).

Stack backtrace
INFO  [rx] framebuffer size: 1280x720
INFO  [rx] scale factor: 1
thread 'main' panicked at 'byte index 16 is not a char boundary; it is inside '§' (bytes 15..17) of `§7[§316x§7] §3Aqua`', /home/neg4n/.cargo/registry/src/github.com-1ecc6299db9ec823/memoir-0.2.1/src/result.rs:39:15
stack backtrace:
 0: rust_begin_unwind
           at /rustc/2987785df3d46d5ff144a5c67fbb8f5cca798d78/library/std/src/panicking.rs:493:5
 1: core::panicking::panic_fmt
           at /rustc/2987785df3d46d5ff144a5c67fbb8f5cca798d78/library/core/src/panicking.rs:92:14
 2: core::str::slice_error_fail
 3: core::str::traits::<impl core::slice::index::SliceIndex<str> for core::ops::range::RangeTo<usize>>::index
           at /home/neg4n/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/traits.rs:289:21
 4: core::str::traits::<impl core::ops::index::Index<I> for str>::index
           at /home/neg4n/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/traits.rs:64:9
 5: memoir::result::Error::expect
           at /home/neg4n/.cargo/registry/src/github.com-1ecc6299db9ec823/memoir-0.2.1/src/result.rs:39:15
 6: memoir::parsers::satisfy::{{closure}}
           at /home/neg4n/.cargo/registry/src/github.com-1ecc6299db9ec823/memoir-0.2.1/src/parsers.rs:338:23
 7: memoir::parsers::many::{{closure}}
           at /home/neg4n/.cargo/registry/src/github.com-1ecc6299db9ec823/memoir-0.2.1/src/parsers.rs:552:41
 8: memoir::parsers::Parser<O>::from_str::{{closure}}
           at /home/neg4n/.cargo/registry/src/github.com-1ecc6299db9ec823/memoir-0.2.1/src/parsers.rs:276:32
 9: memoir::parsers::optional::{{closure}}
           at /home/neg4n/.cargo/registry/src/github.com-1ecc6299db9ec823/memoir-0.2.1/src/parsers.rs:391:34
10: memoir::parsers::Parser<O>::skip::{{closure}}
           at /home/neg4n/.cargo/registry/src/github.com-1ecc6299db9ec823/memoir-0.2.1/src/parsers.rs:146:42
11: memoir::parsers::any::{{closure}}
           at /home/neg4n/.cargo/registry/src/github.com-1ecc6299db9ec823/memoir-0.2.1/src/parsers.rs:512:41
12: memoir::parsers::Parser<O>::then::{{closure}}::{{closure}}
           at /home/neg4n/.cargo/registry/src/github.com-1ecc6299db9ec823/memoir-0.2.1/src/parsers.rs:56:21
13: core::result::Result<T,E>::and_then
           at /home/neg4n/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/result.rs:708:22
14: memoir::parsers::Parser<O>::then::{{closure}}
           at /home/neg4n/.cargo/registry/src/github.com-1ecc6299db9ec823/memoir-0.2.1/src/parsers.rs:55:17
15: memoir::parsers::Parser<O>::map::{{closure}}
           at /home/neg4n/.cargo/registry/src/github.com-1ecc6299db9ec823/memoir-0.2.1/src/parsers.rs:172:26
16: memoir::parsers::choice::{{closure}}
           at /home/neg4n/.cargo/registry/src/github.com-1ecc6299db9ec823/memoir-0.2.1/src/parsers.rs:593:23
17: memoir::parsers::Parser<O>::or::{{closure}}
           at /home/neg4n/.cargo/registry/src/github.com-1ecc6299db9ec823/memoir-0.2.1/src/parsers.rs:109:32
18: memoir::parsers::Parser<O>::then::{{closure}}::{{closure}}
           at /home/neg4n/.cargo/registry/src/github.com-1ecc6299db9ec823/memoir-0.2.1/src/parsers.rs:56:21
19: core::result::Result<T,E>::and_then
           at /home/neg4n/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/result.rs:708:22
20: memoir::parsers::Parser<O>::then::{{closure}}
           at /home/neg4n/.cargo/registry/src/github.com-1ecc6299db9ec823/memoir-0.2.1/src/parsers.rs:55:17
21: memoir::parsers::Parser<O>::map::{{closure}}
           at /home/neg4n/.cargo/registry/src/github.com-1ecc6299db9ec823/memoir-0.2.1/src/parsers.rs:172:26
22: memoir::parsers::Parser<O>::skip::{{closure}}
           at /home/neg4n/.cargo/registry/src/github.com-1ecc6299db9ec823/memoir-0.2.1/src/parsers.rs:145:32
23: memoir::parsers::Parser<O>::skip::{{closure}}
           at /home/neg4n/.cargo/registry/src/github.com-1ecc6299db9ec823/memoir-0.2.1/src/parsers.rs:145:32
24: memoir::parsers::Parser<O>::skip::{{closure}}
           at /home/neg4n/.cargo/registry/src/github.com-1ecc6299db9ec823/memoir-0.2.1/src/parsers.rs:145:32
25: memoir::parsers::Parser<O>::parse
           at /home/neg4n/.cargo/registry/src/github.com-1ecc6299db9ec823/memoir-0.2.1/src/parsers.rs:236:9
26: rx::cmd::CommandLine::parse
           at ./src/cmd.rs:530:15
27: rx::session::Session::cmdline_handle_enter
           at ./src/session.rs:3360:15
28: rx::session::Session::handle_keyboard_input
           at ./src/session.rs:2442:33
29: rx::session::Session::handle_event
           at ./src/session.rs:2121:44
30: rx::session::Session::update
           at ./src/session.rs:1017:17
31: rx::init::{{closure}}
           at ./src/lib.rs:342:36
32: rx::timer::FrameTimer::run
           at ./src/timer.rs:24:22
33: rx::init
           at ./src/lib.rs:342:13
34: rx::execute
           at ./src/main.rs:124:22
35: rx::main
           at ./src/main.rs:31:21
36: core::ops::function::FnOnce::call_once
           at /home/neg4n/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
The terminal process "/usr/bin/zsh '-c', 'cargo run --package rx --bin rx'" terminated with exit code: 101.

Its probably related to string slicing?

Steps to reproduce

This bug was observed when i tried to load Minecraft texturepack :e <path containing unicode> that has many § in name.
image

Additional info

OS: Ubuntu 20.10 x86_64
Kernel: 5.8.0-43-generic