The fuzzer from #40 finds a panic triggered by a byte index that is outside a char boundary.
Adding this to the parser tests:
#[test]
fn issue41() {
let text = ::std::str::from_utf8(b"\'\'fb\'\xee\x9d\xbd").unwrap();
let _ = Parser::new(text).parse();
}
fails with
---- parser::tests::issue41 stdout ----
thread 'parser::tests::issue41' panicked at 'byte index 7 is not a char boundary; it is inside '\u{e77d}' (bytes 5..8) of `''fb'`', src/libcore/str/mod.rs:2235:4
stack backtrace:
0: 0x10ad515eb - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::h42b4ce0b98574016
1: 0x10ad4a2ce - std::sys_common::backtrace::print::h293f72b3c32dfa5b
2: 0x10ad520c0 - _ZN3std9panicking12default_hook28_$u7b$$u7b$closure$u7d$$u7d$17haa05421012ac6c20E.llvm.5B51A422
3: 0x10ad51dc4 - _ZN3std9panicking12default_hook17h2d0d0ff0f27771f9E.llvm.5B51A422
4: 0x10ad52526 - std::panicking::rust_panic_with_hook::h2a8b5b7a95208f5a
5: 0x10ad5237e - _ZN3std9panicking11begin_panic17h1179f738121e3414E.llvm.5B51A422
6: 0x10ad522d3 - std::panicking::begin_panic_fmt::h4986ee369ba2ddac
7: 0x10ad52242 - rust_begin_unwind
8: 0x10ad94273 - core::panicking::panic_fmt::hd9b79e885de0143c
9: 0x10ad98ef4 - core::str::slice_error_fail::h606b34e3191fab74
10: 0x10acb1cbe - core::str::traits::<impl core::slice::SliceIndex<str> for core::ops::range::Range<usize>>::index::{{closure}}::h9b2035a79c64f1dc
11: 0x10acc2f90 - <core::option::Option<T>>::unwrap_or_else::h9be067b5aa4c4510
12: 0x10acbdf6b - core::str::traits::<impl core::slice::SliceIndex<str> for core::ops::range::Range<usize>>::index::h195fcc6753118e5e
13: 0x10acb1c6c - core::str::traits::<impl core::ops::index::Index<core::ops::range::Range<usize>> for str>::index::h779aae528849c22f
14: 0x10accb116 - Molten::parser::Parser::parse_val::hc4a6ac51f5c68f43
15: 0x10acca8de - Molten::parser::Parser::parse_key_value::hb46cee7de7a0d92c
16: 0x10acc9f9b - Molten::parser::Parser::parse_item::h9ead6e84efb9d9e8
17: 0x10acc8719 - Molten::parser::Parser::parse::h70b405a15af60225
18: 0x10acb0ba8 - Molten::parser::tests::issue41::h7425247ee675da6e
19: 0x10ad05961 - _ZN42_$LT$F$u20$as$u20$test..FnBox$LT$T$GT$$GT$8call_box17h07fcc9c8a31cf663E.llvm.B477B8A1
20: 0x10ad6580e - __rust_maybe_catch_panic
21: 0x10acf6200 - std::sys_common::backtrace::__rust_begin_short_backtrace::h727bf0093a90e1fc
22: 0x10acfb9f7 - _ZN3std9panicking3try7do_call17hc2fcbcc92b537a0fE.llvm.1CF3EA36
23: 0x10ad6580e - __rust_maybe_catch_panic
24: 0x10ad11fb1 - _ZN50_$LT$F$u20$as$u20$alloc..boxed..FnBox$LT$A$GT$$GT$8call_box17h765b683cac353d8aE.llvm.4B1D5347
25: 0x10ad4ccf7 - std::sys_common::thread::start_thread::h4ad86c0b3fefeff0
26: 0x10ad579f8 - _ZN3std3sys4unix6thread6Thread3new12thread_start17h333ed09407a7bdcdE.llvm.9AF12AEA
27: 0x7fffa0c4493a - _pthread_body
28: 0x7fffa0c44886 - _pthread_start
The fuzzer from #40 finds a panic triggered by a byte index that is outside a char boundary.
Adding this to the parser tests:
fails with