Closed HeeillWang closed 1 year ago
This is deliberate, as indicated by the error message. The resulting value cannot be represented in the data format.
@jhpratt This is not invoked via expect()
. Note that panic message is printed by rustc, not expect()
. The add operation self.to_julian_day() + (duration.as_secs() / Second.per(Day) as u64) as i32
makes the overflow.
Is it deliberate as well?
Ah, I understand what you're saying now. That wasn't immediately obvious to me.
I suspect that this may lead to a bug in release mode, as wrapping arithmetic would occur in that instance. I'll have to switch to using checked arithmetic instead if I can confirm this.
Fixed on main
.
I executed fuzzing, and found arithmetic overflow bug on
date.rs
. Tested on0.3.22
but would be reproduced on latest version.Reproduce crash with :