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

Panic on invalid cron expression #105

Open
y21 opened this issue May 13, 2022 · 0 comments
Open

Panic on invalid cron expression #105

y21 opened this issue May 13, 2022 · 0 comments

Comments

@y21
Copy link

y21 commented May 13, 2022

The string 1/0 causes a panic when fed to cron::Schedule::from_str (0.11.0):

thread 'testing' panicked at 'assertion failed: step != 0', /rustc/6dd68402c5d7da168f87d8551dd9aed1d8a21893/library/core/src/iter/adapters/step_by.rs:21:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/6dd68402c5d7da168f87d8551dd9aed1d8a21893/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/6dd68402c5d7da168f87d8551dd9aed1d8a21893/library/core/src/panicking.rs:142:14
   2: core::panicking::panic
             at /rustc/6dd68402c5d7da168f87d8551dd9aed1d8a21893/library/core/src/panicking.rs:48:5
   3: core::iter::adapters::step_by::StepBy<I>::new
             at /rustc/6dd68402c5d7da168f87d8551dd9aed1d8a21893/library/core/src/iter/adapters/step_by.rs:21:9
   4: core::iter::traits::iterator::Iterator::step_by
             at /rustc/6dd68402c5d7da168f87d8551dd9aed1d8a21893/library/core/src/iter/traits/iterator.rs:384:9
   5: cron::time_unit::TimeUnitField::ordinals_from_root_specifier
             at /home/timo/.cargo/registry/src/github.com-1ecc6299db9ec823/cron-0.11.0/src/time_unit/mod.rs:310:17
   6: <T as cron::parsing::FromField>::from_field
             at /home/timo/.cargo/registry/src/github.com-1ecc6299db9ec823/cron-0.11.0/src/parsing.rs:60:50

This also happens in earlier versions (I tested 0.6.0), though that requires subexpressions to be present: 1/0 * * * * *

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

No branches or pull requests

1 participant