Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fuzzing: thread 'main' panicked at 'Duration::seconds out of bounds' #18

Open
sylvestre opened this issue Jun 6, 2023 · 3 comments · May be fixed by #20
Open

fuzzing: thread 'main' panicked at 'Duration::seconds out of bounds' #18

sylvestre opened this issue Jun 6, 2023 · 3 comments · May be fixed by #20
Labels
good first issue Good for newcomers

Comments

@sylvestre
Copy link
Sponsor Contributor

sylvestre commented Jun 6, 2023

Code:

fn main() {
let _ = parse_datetime::from_str("8888888888888h");
}

Backtrace:

thread 'main' panicked at 'Duration::seconds out of bounds', /home/sylvestre/.cargo/registry/src/github.com-1ecc6299db9ec823/chrono-0.4.26/src/oldtime.rs:121:13
stack backtrace:
   0: rust_begin_unwind
             at /rustc/8460ca823e8367a30dda430efda790588b8c84d3/library/std/src/panicking.rs:575:5
   1: core::panicking::panic_fmt
             at /rustc/8460ca823e8367a30dda430efda790588b8c84d3/library/core/src/panicking.rs:64:14
   2: chrono::oldtime::Duration::seconds
             at /home/sylvestre/.cargo/registry/src/github.com-1ecc6299db9ec823/chrono-0.4.26/src/oldtime.rs:121:13
   3: chrono::oldtime::Duration::hours
             at /home/sylvestre/.cargo/registry/src/github.com-1ecc6299db9ec823/chrono-0.4.26/src/oldtime.rs:100:9
   4: parse_datetime::from_str_at_date
             at /home/sylvestre/.cargo/registry/src/github.com-1ecc6299db9ec823/parse_datetime-0.4.0/src/lib.rs:166:39
   5: parse_datetime::from_str
             at /home/sylvestre/.cargo/registry/src/github.com-1ecc6299db9ec823/parse_datetime-0.4.0/src/lib.rs:95:5
   6: b::main
             at ./src/main.rs:2:9
   7: core::ops::function::FnOnce::call_once
             at /rustc/8460ca823e8367a30dda430efda790588b8c84d3/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
@undali
Copy link
Contributor

undali commented Jun 7, 2023

Hi @sylvestre ,
Could you please give me an idea?|
The panic has happening on external crates.
Should we add check before calling the chrono functions?

@sylvestre
Copy link
Sponsor Contributor Author

or handle the panic in our crate :)

@undali undali linked a pull request Jun 7, 2023 that will close this issue
@undali
Copy link
Contributor

undali commented Jun 7, 2023

@sylvestre Thanks!
I've created a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants