Serialization data corruption with Duration and serde_human_readable
for negative subsecond durations
#691
Labels
serde_human_readable
for negative subsecond durations
#691
The issue is here:
time/time/src/serde/mod.rs
Line 257 in aca5c36
When feature
serde_human_readable
is enabled, the serializing code incorrectly assumes that for a sub-second negative duration, theself.whole_seconds()
will provide the sign during printing. Similar issue exists with deserialization code.The bug will result with subsecond negative Durations being serialized into positive ones, and negative elsewhere-serialized Durations to be deserialized into positive ones.
Also the comment here:
time/time/src/duration.rs
Line 44 in aca5c36
nanoseconds
sign will NOT match theseconds
sign whenseconds
is 0 andnanoseconds
is negative.The text was updated successfully, but these errors were encountered: