From 45a7b8b0d993f565c9de742d3300863cf37d5cb2 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Mon, 24 Oct 2022 22:03:03 +1100 Subject: [PATCH] Update src/ImageSharp/Processing/Processors/Quantization/DefaultPixelSamplingStrategy.cs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Günther Foidl --- .../Processors/Quantization/DefaultPixelSamplingStrategy.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ImageSharp/Processing/Processors/Quantization/DefaultPixelSamplingStrategy.cs b/src/ImageSharp/Processing/Processors/Quantization/DefaultPixelSamplingStrategy.cs index 5c387949e5..7be36014c6 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/DefaultPixelSamplingStrategy.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/DefaultPixelSamplingStrategy.cs @@ -137,7 +137,8 @@ public class DefaultPixelSamplingStrategy : IPixelSamplingStrategy for (int pos = 0; pos < totalNumberOfRows; pos++) { - int subPos = pos % denom; + Debug.Assert(denom > 0); + int subPos = (int)((uint)pos % (uint)denom); if (subPos < num) { yield return GetRow(pos);