Skip to content

Commit bdf9f1a

Browse files
committed
Fix tests
1 parent 9847ddb commit bdf9f1a

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

csharp/src/Google.Protobuf/CodedInputReader.cs

+1-5
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,6 @@ public uint ReadTag()
226226
// If we actually read a tag with a field of 0, that's not a valid tag.
227227
ThrowInvalidTagException();
228228
}
229-
if (ReachedLimit)
230-
{
231-
return 0;
232-
}
233229

234230
return lastTag;
235231
}
@@ -1308,7 +1304,7 @@ private void ValidateRequestedDataAvaliable(int length)
13081304
if (length + reader.Consumed > currentLimit)
13091305
{
13101306
// Read to the end of the limit.
1311-
reader.Advance(currentLimit);
1307+
reader.Advance(Math.Min(currentLimit, reader.Remaining));
13121308
// Then fail.
13131309
ThrowTruncatedMessage();
13141310
}

0 commit comments

Comments
 (0)