Protobuf field malformed packet for last byte of 'repeated fixed32'
Summary
In case my protobuf message has 'repeated fixed32' on the end, this field could not be parsed correctly with Wireshark protobuf dissector, it shows 'Malformed packet' for the last byte, despite it also has 4 bytes. If it has only one byte - it shows 'Malformed packet' for this single byte.
e.g. I meet this in a simple messages like
message Response { repeated fixed32 Id = 1; } or bigger messages like:
message My_Cmd { fixed32 field1 = 1; fixed32 field2 = 2; fixed32 field3 = 3; fixed32 payloadSize = 4; repeated fixed32 payload = 5; }
https://protobuf.dev/programming-guid... --> it says that 'packed repeated fields' has wire type = 2 and fixed32 = 5, looks like this ternary operator is incorrect here:
(wire_type == PROTOBUF_WIRETYPE_FIXED32 ? tvb_get_guint32(tvb, offset, ENC_LITTLE_ENDIAN) : tvb_get_guint64(tvb, offset, ENC_LITTLE_ENDIAN))
This WA is my suggestion for fixing the issue, with this WA it works as expected. Debug steps I described in this question on the forum in the comments. https://ask.wireshark.org/question/32430/protobuf-field-malformed-packet-for-last-byte-of-repeated-fixed32/
Sample capture file
Steps to reproduce
What is the current bug behavior?
What is the expected correct behavior?
That repeated fixed 32 parsed correctly
Build information
Version 4.0.8 (v4.0.8-0-g81696bb74857).
Compiled (64-bit) using Microsoft Visual Studio 2022 (VC++ 14.36, build 32537),
with GLib 2.72.3, with PCRE2, with zlib 1.2.12, with Qt 5.15.2, with libpcap,
with Lua 5.2.4, with GnuTLS 3.6.3 and PKCS #11 support, with Gcrypt 1.10.1, with
Kerberos (MIT), with MaxMind, with nghttp2 1.46.0, with brotli, with LZ4, with
Zstandard, with Snappy, with libxml2 2.9.14, with libsmi 0.4.8, with
QtMultimedia, with automatic updates using WinSparkle 0.8.0, with AirPcap, with
SpeexDSP (using bundled resampler), with Minizip, with binary plugins.
Running on 64-bit Windows 10 (21H2), build 19044, with 11th Gen Intel(R)
Core(TM) i5-1135G7 @ 2.40GHz (with SSE4.2), with 16086 MB of physical memory,
with GLib 2.72.3, with PCRE2 10.40 2022-04-14, with Qt 5.15.2, with Npcap
version 1.71, based on libpcap version 1.10.2-PRE-GIT, with c-ares 1.18.1, with
GnuTLS 3.6.3, with Gcrypt 1.10.1, with nghttp2 1.46.0, with brotli 1.0.9, with
LZ4 1.9.3, with Zstandard 1.5.2, without AirPcap, with light display mode, with
HiDPI, with LC_TYPE=English_United States.utf8, binary plugins supported.