mirror of
https://github.com/protobuf-c/protobuf-c.git
synced 2025-01-14 01:07:57 +08:00
Check if tag is equal to 0
This is needed because in the syntax of Google protobuf the zero value is not valid tag value. The specification (https://developers.google.com/protocol-buffers/docs/proto3) says that "The smallest tag number you can specify is 1, and the largest is 2^29-1, or 536,870,911."
This commit is contained in:
parent
dac1a65fea
commit
565118bf26
@ -2072,6 +2072,11 @@ parse_tag_and_wiretype(size_t len,
|
||||
unsigned shift = 4;
|
||||
unsigned rv;
|
||||
|
||||
/* 0 is not a valid tag value */
|
||||
if ((data[0] & 0xf8) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
*wiretype_out = data[0] & 7;
|
||||
if ((data[0] & 0x80) == 0) {
|
||||
*tag_out = tag;
|
||||
|
Loading…
x
Reference in New Issue
Block a user