-
Notifications
You must be signed in to change notification settings - Fork 16.1k
Protobuf messages contains Any aren't serialized deterministically even specifying so #5731
Description
What version of protobuf and what language are you using?
Version: master (currently at 7492b56)
Language: C++
What operating system (Linux, Windows, ...) and version?
Linux
What runtime / compiler are you using (e.g., python version or gcc version)
gcc-7 / clang-7
What did you do?
Deterministic serialize a message and calculate hash based on the serialized binary.
Source: https://github.com/envoyproxy/envoy/blob/master/source/common/protobuf/utility.h#L162
What did you expect to see
Same proto generates same serialized binary and hash.
What did you see instead?
Same proto generates different serialized binary and hash.
Anything else we should know about your project / environment
This is a follow up of #5668, even we use the CodedOutputStream with SetSerializationDeterministic(true), the same protobuf message (from JSON debug dump) doesn't produce same binary serialization. My suspect is that the Any in the message has different value while they are same. Deterministic serialization should normalize value in Any too.