Browse Source

Fix read bug.

pull/2828/head
James Jackson-South 1 year ago
parent
commit
c45702df5b
  1. 9
      src/ImageSharp/IO/ChunkedMemoryStream.cs

9
src/ImageSharp/IO/ChunkedMemoryStream.cs

@ -124,7 +124,13 @@ internal sealed class ChunkedMemoryStream : Stream
return 0;
}
int bytesToRead = count;
if (remaining > count)
{
remaining = count;
}
// 'remaining' can be less than the provided buffer length.
int bytesToRead = (int)remaining;
int bytesRead = 0;
while (bytesToRead > 0 && this.bufferIndex != this.memoryChunkBuffer.Length)
{
@ -422,7 +428,6 @@ internal sealed class ChunkedMemoryStream : Stream
}
this.memoryChunks.Clear();
this.Length = 0;
this.isDisposed = true;
}

Loading…
Cancel
Save