taichino / croniter

croniter is a python module to provide iteration for datetime object.
http://github.com/taichino/croniter
387 stars 105 forks source link

func is_valid crashed when checking '*/0 * * * *' cron string #114

Closed yitian-reevo closed 5 years ago

yitian-reevo commented 6 years ago

Hi guys.

Accidentally found an issue when using is_valid func with parameter '/0 *', the expect return is False, while somehow the program crashed.

I actually located where the problem is, it's in croniter.py Line 499. m.group(4) or 1 failed to return 1 when m.group(4) == '0', which then further caused variable step became 0, then it crashed.

Could you please fix this?

kiorky commented 6 years ago

Uhm, i need to investigate but your cron line seems invalid for me, so at least its normal that it wont work.

*/0 mean each 0 minutes, division by zero !

yitian-reevo commented 6 years ago

As a programmer, I totally understand this cron line is invalid, and stupid! But we cannot control that somebody attempts to do this to let their jobs run continually.

Thanks for working on this!

kiorky commented 6 years ago

Ok, no problemo, as i said i ll look how to make croniter not crash. I wanted just to be clear on the invalidness of the expression. thx for reporting !

kiorky commented 5 years ago

https://pypi.org/project/croniter/0.3.27/ is out

yitian-reevo commented 5 years ago

Fabulous! Thanks.

kiorky commented 5 years ago

Better later than never ^^ :).