Browse Source

Apply suggestions from code review

Co-authored-by: Günther Foidl <gue@korporal.at>
pull/2023/head
ratok-mk 4 years ago
committed by GitHub
parent
commit
a30f40ce34
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      src/ImageSharp/Compression/Zlib/DeflaterEngine.cs

7
src/ImageSharp/Compression/Zlib/DeflaterEngine.cs

@ -483,14 +483,15 @@ namespace SixLabors.ImageSharp.Compression.Zlib
int niceLength = Math.Min(this.niceLength, this.lookahead);
int matchStrt = this.matchStart;
this.matchLen = Math.Max(this.matchLen, DeflaterConstants.MIN_MATCH - 1);
int matchLength = this.matchLen;
matchLength = Math.Max(matchLength, DeflaterConstants.MIN_MATCH - 1);
this.matchLen = matchLength;
int scanEndPosition = scan + matchLength;
if (scanEndPosition > scanMax)
if (scan > scanMax - matchLength)
{
return false;
}
int scanEndPosition = scan + matchLength;
byte* pinnedWindow = this.pinnedWindowPointer;
int scanStart = this.strstart;

Loading…
Cancel
Save