BaldDemian commented on issue #3484:
URL: https://github.com/apache/fory/issues/3484#issuecomment-4072132485

   After some digging, I think there is another buggy side of the usage of 
`std::time::Duration` in Rust. According to the xlang spec, the `seconds` field 
of a `duration` is encoded as a signed varint64, so its maximum value is 
`i64::MAX`. However, in Rust, a user can construct a `Duration` whose `seconds` 
value exceeds `i64::MAX` and still encode it, because Fory does not enforce 
this bound during serialization. When a Java user later decodes the value, the 
resulting `Duration` in Java may contain a negative `seconds`, which is clearly 
not what the original user intended.
   
   I am willing to fix this issue, but replacing `std::time::Duration` with 
`chrono::Duration` will introduce user-facing change. Glad to hear your advice 
@chaokunyang .


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to