Fix bug when parsing from non-seekable streams.

pull/464/head
Paul Du Bois (laptop) 10 years ago
parent 9cbdaedb86
commit 7c86bbbc7a
  1. 3
      csharp/src/ProtocolBuffers/CodedInputStream.cs

@ -1813,7 +1813,8 @@ namespace Google.ProtocolBuffers
byte[] skipBuffer = new byte[1024];
while (amountToSkip > 0)
{
int bytesRead = input.Read(skipBuffer, 0, skipBuffer.Length);
int bytesRead = input.Read(
skipBuffer, 0, Math.Min(skipBuffer.Length, amountToSkip));
if (bytesRead <= 0)
{
throw InvalidProtocolBufferException.TruncatedMessage();

Loading…
Cancel
Save