bspeice/dtparse

panicked at 'called `Result::unwrap()` on an `Err` value: InvalidNumeric("number too large to fit in target type")'

Closed this issue · 3 comments

Input
666666666662666666666s�62666666666s6$$

Output

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: InvalidNumeric("number too large to fit in target type")', /home/xsh/.cargo/registry/src/github.com-1ecc6299db9ec823/dtparse-1.2.0/src/lib.rs:1282:57
stack backtrace:
   0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
   1: core::fmt::write
   2: std::io::Write::write_fmt
   3: std::panicking::default_hook::{{closure}}
   4: std::panicking::default_hook
   5: std::panicking::rust_panic_with_hook
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::result::unwrap_failed
   9: core::result::Result<T,E>::unwrap
             at /home/xsh/code/rust-compiler/src/libcore/result.rs:1005
  10: dtparse::Parser::assign_hms
             at /home/xsh/.cargo/registry/src/github.com-1ecc6299db9ec823/dtparse-1.2.0/src/lib.rs:1282
  11: dtparse::Parser::parse_numeric_token
             at /home/xsh/.cargo/registry/src/github.com-1ecc6299db9ec823/dtparse-1.2.0/src/lib.rs:1097
  12: dtparse::Parser::parse_with_tokens
             at /home/xsh/.cargo/registry/src/github.com-1ecc6299db9ec823/dtparse-1.2.0/src/lib.rs:771
  13: dtparse::Parser::parse
             at /home/xsh/.cargo/registry/src/github.com-1ecc6299db9ec823/dtparse-1.2.0/src/lib.rs:719
  14: dtparse::parse
             at /home/xsh/.cargo/registry/src/github.com-1ecc6299db9ec823/dtparse-1.2.0/src/lib.rs:1346

Expect
return error properly instead of panic

Can you please give me the input string as either a list of hexadecimal values or base64-encoded string? I can't retrieve the text as it is from Github Issues.

No longer panics, I've added this as a test case.