aboutsummaryrefslogtreecommitdiff
path: root/objectivec/GPBCodedInputStream.m
diff options
context:
space:
mode:
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;
}