Map Adapter cannot handle Value whose representation can be zero bytes #3153
Open
Description
opened on Oct 23, 2024
Subj
If you use message like:
message ValidZeroPayload {
float distance_meters = 2;
reserved 1;
}
Wire will choke on parsing map with value initialized as:
ValidZeroPayload {
distance_meters: 0.0
}
That's because it will be encoded as zero bytes due to zero being treated as non-presence in case of integers and floats
Therefore it triggers this check to fail:
https://github.com/square/wire/blob/master/wire-runtime/src/commonMain/kotlin/com/squareup/wire/ProtoAdapter.kt#L812
Even though message itself is legit in protobuf 3
Metadata
Assignees
Labels
No labels
Activity