Open
Description
From
implementations for Timestamp
and Duration
well-known types that convert to standard library std::time::SystemTime
and std::time::Duration
state that they panic when given values out of the allowed range. However, this is against the contract that From
imposes on implementations:
Note: This trait must not fail. The
From
trait is intended for perfect conversions. If the conversion can fail or is not perfect, useTryFrom
.
This contract breakage is especially severe in the case of protobuf
crate as Protocol Buffers messages usually contain data from "the outside" and should not be trusted. If the application relies on the fact that From
conversion cannot fail (as I usually do), it means that a malformed message can easily bring it down.
Metadata
Metadata
Assignees
Labels
No labels