aboutsummaryrefslogtreecommitdiff
path: root/objectivec/GPBCodedInputStream.m
diff options
context:
space:
mode:
authorJisi Liu <jisi.liu@gmail.com>2017-07-18 16:26:16 -0700
committerJisi Liu <jisi.liu@gmail.com>2017-07-18 16:26:16 -0700
commit3af881c7e2db0553207876acbdb91c6e77974e44 (patch)
tree35e2a96cce802d4235bd29afa396e28ead892fa2 /objectivec/GPBCodedInputStream.m
parent86975301f1876ce1934612777b8ca6c76520f5cc (diff)
parent942a29cecd36f2a4b22fdd2179635cd548e6bd27 (diff)
downloadprotobuf-3af881c7e2db0553207876acbdb91c6e77974e44.tar.gz
protobuf-3af881c7e2db0553207876acbdb91c6e77974e44.tar.bz2
protobuf-3af881c7e2db0553207876acbdb91c6e77974e44.zip
Merge master into 3.4.x
Diffstat (limited to 'objectivec/GPBCodedInputStream.m')
-rw-r--r--objectivec/GPBCodedInputStream.m12
1 files changed, 6 insertions, 6 deletions
diff --git a/objectivec/GPBCodedInputStream.m b/objectivec/GPBCodedInputStream.m
index eef05353..22859e77 100644
--- a/objectivec/GPBCodedInputStream.m
+++ b/objectivec/GPBCodedInputStream.m
@@ -230,16 +230,16 @@ int32_t GPBCodedInputStreamReadTag(GPBCodedInputStreamState *state) {
}
state->lastTag = ReadRawVarint32(state);
- if (state->lastTag == 0) {
- // If we actually read zero, that's not a valid tag.
- RaiseException(GPBCodedInputStreamErrorInvalidTag,
- @"A zero tag on the wire is invalid.");
- }
- // Tags have to include a valid wireformat, check that also.
+ // Tags have to include a valid wireformat.
if (!GPBWireFormatIsValidTag(state->lastTag)) {
RaiseException(GPBCodedInputStreamErrorInvalidTag,
@"Invalid wireformat in tag.");
}
+ // Zero is not a valid field number.
+ if (GPBWireFormatGetTagFieldNumber(state->lastTag) == 0) {
+ RaiseException(GPBCodedInputStreamErrorInvalidTag,
+ @"A zero field number on the wire is invalid.");
+ }
return state->lastTag;
}