We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6301662 commit c45702dCopy full SHA for c45702d
src/ImageSharp/IO/ChunkedMemoryStream.cs
@@ -124,7 +124,13 @@ public override int Read(Span<byte> buffer)
124
return 0;
125
}
126
127
- int bytesToRead = count;
+ if (remaining > count)
128
+ {
129
+ remaining = count;
130
+ }
131
+
132
+ // 'remaining' can be less than the provided buffer length.
133
+ int bytesToRead = (int)remaining;
134
int bytesRead = 0;
135
while (bytesToRead > 0 && this.bufferIndex != this.memoryChunkBuffer.Length)
136
{
@@ -422,7 +428,6 @@ public void Dispose()
422
428
423
429
424
430
this.memoryChunks.Clear();
425
-
426
431
this.Length = 0;
427
432
this.isDisposed = true;
433
0 commit comments