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

reproduce and fix date fuzz error #1488

Merged
merged 2 commits into from
Aug 3, 2024
Merged

reproduce and fix date fuzz error #1488

merged 2 commits into from
Aug 3, 2024

Conversation

Byron
Copy link
Member

@Byron Byron commented Aug 3, 2024

Reproduce a fuzz failure.

Fortunately it's just an incorrect expectation.

Tasks

  • reproduce
  • fix

@Byron
Copy link
Member Author

Byron commented Aug 3, 2024

I thought you'd find this interesting, @BurntSushi , as this is an expectation failure.

date is in range: Error { inner: ErrorInner { kind: Adhoc(error converting datetime -009999-01-01T00:00:00 to instant in time zone UTC), cause: Some(Error { inner: ErrorInner { kind: Range(RangeError(Negative { what: "second", given: 0, min: -377705023201, max: 253402207200 })), cause: None } }) } }
thread 'time::parse::fuzz::invalid_but_does_not_cause_panic' panicked at gix-date/src/parse.rs:36:51:

Probably that's just a mistake and the fix is as easy as it looks, but I'd be glad if you would let me know. Thank you.

@Byron Byron marked this pull request as ready for review August 3, 2024 09:03
@Byron Byron merged commit 3604a3b into main Aug 3, 2024
19 checks passed
@Byron Byron deleted the fix-fuzz branch August 3, 2024 10:51
@BurntSushi
Copy link
Contributor

Yup that is indeed an expected error! Nice find fuzzer. I think I used expect() here because that's what it did previously with time, but indeed, this should be an error. (time I believe supports a bigger range than Jiff does.)

For why this happens, Jiff guarantees that every Timestamp can be converted to a civil::DateTime, but sacrifices the opposite direction at the boundaries. The error cases in this example might help make this clearer. (The example uses DateTime::MAX instead of DateTime::MIN, but it's the same idea.)

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

Successfully merging this pull request may close these issues.

2 participants