Protobuf: failed to parse .proto file contains negative enum values or option values of number type
Summary
Wireshark failed to load a '.proto' file contains negative enum values or option values of number type.
Steps to reproduce
Put the file test_default_value.proto in one of the 'Protobuf search paths' in Protobuf protocol preferences, and make this path 'load all files' option on. Then open any Protobuf capture file, you will get the syntax error about parsing .proto file.
You can open this capture protobuf_test_default_value.pcapng. Make sure to add UDP port 8128 and wireshark.protobuf.test.TestDefaultValueMessage
to your 'Protobuf UDP Message Types' table in preferences.
What is the current bug behavior?
If a '.proto' file contains negative enum values or option values of number type in your 'Protobuf search paths', when you open any Protobuf related capture file, Wireshark will popup am Error dialog complain the syntax error in that .proto file.
Following describe where errors occur.
syntax = "proto2";
package wireshark.protobuf.test;
message TestDefaultValueMessage {
enum EnumFoo {
ENUM_FOO_V_FIRST = 1;
ENUM_FOO_V_SECOND = 0x2;
ENUM_FOO_V_THIRD = 3;
ENUM_FOO_V_FOURTH = - 4; // Wireshark protobuf dissector report error because of -4.
}
...
required int32 int32WithValue_8 = 1 [ default = 2 ]; // Wireshark report error because of 2.
...
What is the expected correct behavior?
test_default_value.proto is a valid .proto file (in 'proto2' syntax). Wireshark protobuf dissector should not report error.
Sample capture file
- test_default_value.proto - example .proto file.
- protobuf_test_default_value.pcapng - sample capture.
Relevant logs and/or screenshots
(Paste any relevant logs)
Build information
3.4.0