File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 11# JSON input or output tests are skipped (in conformance_objc.m) as mobile
22# platforms don't support JSON wire format to avoid code bloat.
33
4- Required.*.ProtobufInput.BadTag_FieldNumberTooHigh # Should have failed to parse, but didn't.
5- Required.*.ProtobufInput.BadTag_FieldNumberSlightlyTooHigh # Should have failed to parse, but didn't.
64Required.*.ProtobufInput.BadTag_OverlongVarint # Should have failed to parse, but didn't.
Original file line number Diff line number Diff line change @@ -206,7 +206,13 @@ int32_t GPBCodedInputStreamReadTag(GPBCodedInputStreamState *state) {
206206 return 0 ;
207207 }
208208
209- state->lastTag = ReadRawVarint32 (state);
209+ uint64_t rawTag = (uint64_t )ReadRawVarint64 (state);
210+ state->lastTag = (int32_t )rawTag;
211+ // Following _upb_Decoder_DecodeLongTag logic, fail if this is >32bit value.
212+ if (rawTag > (uint64_t )UINT32_MAX) {
213+ GPBRaiseStreamError (GPBCodedInputStreamErrorInvalidTag, @" Invalid tag" );
214+ }
215+
210216 // Tags have to include a valid wireformat.
211217 if (!GPBWireFormatIsValidTag (state->lastTag )) {
212218 GPBRaiseStreamError (GPBCodedInputStreamErrorInvalidTag, @" Invalid wireformat in tag." );
You can’t perform that action at this time.
0 commit comments