kotlinx.serialization icon indicating copy to clipboard operation
kotlinx.serialization copied to clipboard

Protobuf - `sintXX`, `fixedXX` and `sfixedXX` array can't be serialized / deserialized

Open Dogacel opened this issue 2 years ago • 0 comments

Describe the bug

Types repeated fixed32, repeated fixed64, repeated sfixed32 and repeated sfixed64 that are packed/unpacked can't be serialized / deserialized.

Types repeated sint32 and repeated sint64 is deserialized incorrectly.

To Reproduce

    @ProtoNumber(79) @ProtoPacked val packedSint32: List<Int> = emptyList(),
    @ProtoNumber(80) @ProtoPacked val packedSint64: List<Long> = emptyList(),
    @ProtoNumber(81) @ProtoPacked val packedFixed32: List<Int> = emptyList(),
    @ProtoNumber(82) @ProtoPacked val packedFixed64: List<Long> = emptyList(),
    @ProtoNumber(83) @ProtoPacked val packedSfixed32: List<Int> = emptyList(),
    @ProtoNumber(84) @ProtoPacked val packedSfixed64: List<Long> = emptyList(),

Results in

While parsing a protocol message, the input ended unexpectedly in the middle of a field.  This could mean either that the input has been truncated or that an embedded message misreported its own length.

Expected behavior

Should serialize and deserialize correctly.

Environment

  • Kotlin version: 1.9.0
  • Library version: 1.6.1
  • Kotlin platforms: All

Dogacel avatar Aug 23 '23 20:08 Dogacel