-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: BSON
Attempting to deserialize a BSON datetime with a large number of milliseconds from epoch can result in a panic, as per the chrono docs: https://docs.rs/chrono/0.4.19/chrono/offset/trait.TimeZone.html#method.timestamp_millis.
We should fix this to return an error rather than panicking.
repro:
let json = json!({ "d": { "$date": { "$numberLong": i64::MAX.to_string() } } }); let d = serde_json::from_value::<Document>(json); println!("{:?}", d);
yields:
thread 'main' panicked at 'No such local time', /home/patrick/.cargo/registry/src/github.com-1ecc6299db9ec823/chrono-0.4.19/src/offset/mod.rs:173:34