Protobuf: Regression in handling of 0 values for google.protobuf.Int64Value types (and maybe others)

Created on 31 Jan 2020  路  6Comments  路  Source: protocolbuffers/protobuf

What version of protobuf and what language are you using?
Version: Ruby 3.11.2

What did you do?
Simplified/Minimal Example.

message Wrapper {
  google.protobuf.Int64Value id = 1;
}
  Wrapper.decode(Wrapper.new( id: Google::Protobuf::Int64Value.new( value: 0) ).to_proto)

OUTOUT <Wrapper: id: nil>

What did you expect to see?
<Wrapper: id: <Google::Protobuf::Int64Value: value: 0>>

What did you see instead?
<Wrapper: id: nil>
Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

Anything else we should know about your project / environment?

This works on version 3.7.1 of the gem as expected. This is a very dangerous bug in my opinion, as it can break applications...

Most helpful comment

Thanks @djquan, I missed those other issues. This is probably a duplicate of #7029. This should probably have more attention than it is getting. This can cause serious bugs, as 0 values get dropped. It nearly caused a serious issue at my job.

All 6 comments

This is working as expected in 3.10.1 so it is just an issue in the two 3.11.X releases

Both versions encode the same, so it seems like an issue with decoding

I've seen this behavior too, and reproduced it in a test a while ago, https://github.com/protocolbuffers/protobuf/pull/7037 . No response yet on that though

Thanks @djquan, I missed those other issues. This is probably a duplicate of #7029. This should probably have more attention than it is getting. This can cause serious bugs, as 0 values get dropped. It nearly caused a serious issue at my job.

Totally agree, it also almost caused an issue for us too

This was fixed in https://github.com/protocolbuffers/protobuf/pull/7195. Sorry about that!

Was this page helpful?
0 / 5 - 0 ratings