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

CrontabSchedule.Parse throws OverflowException instead of CrontabException #43

Open
Metalnem opened this Issue Dec 26, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@Metalnem
Copy link

Metalnem commented Dec 26, 2018

CrontabSchedule.Parse can sometimes throw OverflowException instead of CrontabException. Here is the full program to reproduce this:

namespace NCrontab.Run
{
  public class Program
  {
    public static void Main(string[] args)
    {
      CrontabSchedule.Parse("2222222222222222222222222220  12 * */2 Mon");
    }
  }
}

And here is the full stack trace:

An unhandled exception of type 'System.OverflowException' occurred in System.Private.CoreLib.dll: 'Value was either too large or too small for an Int32.'
   at System.Number.ParseInt32(ReadOnlySpan`1 s, NumberStyles style, NumberFormatInfo info)
   at NCrontab.CrontabFieldImpl.ParseValue(String str)
   at NCrontab.CrontabFieldImpl.InternalParse[T](String str, CrontabFieldAccumulator`1 acc, T success, Func`2 errorSelector)
   at NCrontab.CrontabFieldImpl.TryParse[T](String str, CrontabFieldAccumulator`1 acc, T success, Func`2 errorSelector)
   at NCrontab.CrontabField.TryParse[T](CrontabFieldKind kind, String expression, Func`2 valueSelector, Func`2 errorSelector)
   at NCrontab.CrontabSchedule.TryParse[T](String expression, ParseOptions options, Func`2 valueSelector, Func`2 errorSelector)

Found via SharpFuzz.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment