Skip to content

Commit

Permalink
Check for invalid cast
Browse files Browse the repository at this point in the history
  • Loading branch information
pitdicker committed Feb 27, 2024
1 parent a7222fb commit bc03a0f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/naive/datetime/serde.rs
Expand Up @@ -972,7 +972,11 @@ pub mod ts_seconds {
where
E: de::Error,
{
NaiveDateTime::from_timestamp_opt(value as i64, 0).ok_or_else(|| invalid_ts(value))
if value > i64::MAX as u64 {
Err(invalid_ts(value))

Check warning on line 976 in src/naive/datetime/serde.rs

View check run for this annotation

Codecov / codecov/patch

src/naive/datetime/serde.rs#L976

Added line #L976 was not covered by tests
} else {
NaiveDateTime::from_timestamp_opt(value as i64, 0).ok_or_else(|| invalid_ts(value))
}
}
}
}
Expand Down

0 comments on commit bc03a0f

Please sign in to comment.