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

Serde panics when deserializing malformed Duration #1933

Closed
dnaq opened this issue Dec 10, 2020 · 0 comments · Fixed by #1958
Closed

Serde panics when deserializing malformed Duration #1933

dnaq opened this issue Dec 10, 2020 · 0 comments · Fixed by #1958

Comments

@dnaq
Copy link

dnaq commented Dec 10, 2020

The documentation for std::time::Duration::new states that it panics if nanos overflows and causes secs to overflow.

This should cause a deserialization error instead of causing the application to panic.

jonasbb added a commit to jonasbb/serde that referenced this issue Jan 20, 2021
std::time::Duration::new can panic. There is no alternative non-panicing constructor.
Check the panic condition beforehand and return an error instead of panicing.

Fixes serde-rs#1933
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant