dtparse icon indicating copy to clipboard operation
dtparse copied to clipboard

bug: `dtparse::parse` panics when parsing certain strings

Open nagata-yoshiteru opened this issue 1 year ago • 0 comments

Thank you for your nice project.

I used dtparse to determine if the given string can be parsed to datetime. I accidentally found that calling dtparse::parse on the input 263660314029650025864127edc124c2 triggers an internal Option::unwrap() and causes a panic instead of returning a parse error.

To reproduce, run the following code:

use dtparse::parse;

fn main() {
    // This call panics
    let (_dt, _offset) = parse("263660314029650025864127edc124c2").unwrap();
}

It generates the following error:

thread 'main' panicked at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/dtparse-2.0.1/src/lib.rs:1172:51:
called `Option::unwrap()` on a `None` value

nagata-yoshiteru avatar May 02 '25 03:05 nagata-yoshiteru