You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#[test]fntruncated_with_surrogate(){// Character U+24B62, encoded as D852 DF62 in UTF16let buf= "𤭢";letmut s = widestring::U16String::from_str(buf);
s.pop_char();}
output:
thread 'windows::mount::tests::truncated_with_surrogate' panicked at C:\Users\gbleu\.cargo\registry\src\index.crates.io-6f17d22bba15001f\widestring-1.0.2\src\ustring.rs:1286:42:
index out of bounds: the len is 1 but the index is 1
stack backtrace:
0: std::panicking::begin_panic_handler
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library\std\src\panicking.rs:645
1: core::panicking::panic_fmt
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library\core\src\panicking.rs:72
2: core::panicking::panic_bounds_check
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library\core\src\panicking.rs:190
3: core::slice::index::impl$2::index<u16>
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112\library\core\src\slice\index.rs:258
4: alloc::vec::impl$12::index<u16,usize,alloc::alloc::Global>
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112\library\alloc\src\vec\mod.rs:2732
5: widestring::ustring::U16String::pop_char
at C:\Users\gbleu\.cargo\registry\src\index.crates.io-6f17d22bba15001f\widestring-1.0.2\src\ustring.rs:1286
6: libparsec_platform_mountpoint::windows::mount::tests::truncated_with_surrogate
at .\tests\unit\windows_volume_label.rs:40
7: libparsec_platform_mountpoint::windows::mount::tests::truncated_with_surrogate::closure$0
at .\tests\unit\windows_volume_label.rs:35
8: core::ops::function::FnOnce::call_once<libparsec_platform_mountpoint::windows::mount::tests::truncated_with_surrogate::closure_env$0,tuple$<> >
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112\library\core\src\ops\function.rs:250
9: core::ops::function::FnOnce::call_once
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library\core\src\ops\function.rs:250
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Canceling due to test failure: 0 tests still running
output:
I guess this is due to a off-by-one issue here:
widestring-rs/src/ustring.rs
Line 1286 in e123e39
(should be
self.inner[self.len() - 1]
)The text was updated successfully, but these errors were encountered: