Skip to content

Commit

Permalink
Fix bug when parsing from non-seekable streams.
Browse files Browse the repository at this point in the history
  • Loading branch information
dubois committed Jun 9, 2015
1 parent 9cbdaed commit 7c86bbb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion csharp/src/ProtocolBuffers/CodedInputStream.cs
Expand Up @@ -1813,7 +1813,8 @@ private void SkipImpl(int amountToSkip)
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();
Expand Down

0 comments on commit 7c86bbb

Please sign in to comment.