-
Notifications
You must be signed in to change notification settings - Fork 15.6k
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
Protobuf messages contains Any aren't serialized deterministically even specifying so #5731
Comments
@liujisi , any ideas? The fix is critical and your help is greatly appreciated. |
@acozzette any thoughts? |
@lizan This may be a hard problem to solve. The way If you need a quick short-term fix, I think the best solution would be to have your hash function reflectively examine the proto and normalize all Any fields before doing the deterministic serialization of the full message. That may end up being slow, though. It might also be worthwhile to just avoid Any fields in messages that you want to be able to hash. Do you have a lot of Any fields or just a few? |
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment. This issue is labeled |
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it. This issue was closed and archived because there has been no new activity in the 14 days since the |
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
withSetSerializationDeterministic(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 differentvalue
while they are same. Deterministic serialization should normalize value in Any too.The text was updated successfully, but these errors were encountered: