Browse Source

Add more cancellation checks

pull/2276/head
James Jackson-South 3 years ago
parent
commit
a58e6ff53d
  1. 2
      src/ImageSharp/IO/BufferedReadStream.cs

2
src/ImageSharp/IO/BufferedReadStream.cs

@ -90,6 +90,7 @@ internal sealed class BufferedReadStream : Stream
set
{
Guard.MustBeGreaterThanOrEqualTo(value, 0, nameof(this.Position));
this.cancellationToken.ThrowIfCancellationRequested();
// Only reset readBufferIndex if we are out of bounds of our working buffer
// otherwise we should simply move the value by the diff.
@ -262,6 +263,7 @@ internal sealed class BufferedReadStream : Stream
[MethodImpl(MethodImplOptions.NoInlining)]
private void FillReadBuffer()
{
this.cancellationToken.ThrowIfCancellationRequested();
Stream baseStream = this.BaseStream;
if (this.readerPosition != baseStream.Position)
{

Loading…
Cancel
Save