Skip to content

Map Adapter cannot handle Value whose representation can be zero bytes #3153

Open
@DoumanAsh

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions