Skip to content

bug: dtparse::parse panics when parsing certain strings #51

Description

@nagata-yoshiteru

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions