From 55ae240f87be6a60dace612bbcb60a986f0d65fa Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Tue, 8 Nov 2022 18:35:33 +1000 Subject: [PATCH] Fix gif decoder tests --- src/ImageSharp/Formats/Gif/GifDecoderCore.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ImageSharp/Formats/Gif/GifDecoderCore.cs b/src/ImageSharp/Formats/Gif/GifDecoderCore.cs index a16e04783..1b21c37f4 100644 --- a/src/ImageSharp/Formats/Gif/GifDecoderCore.cs +++ b/src/ImageSharp/Formats/Gif/GifDecoderCore.cs @@ -548,7 +548,7 @@ internal sealed class GifDecoderCore : IImageDecoderInternals // #403 The left + width value can be larger than the image width for (int x = descriptorLeft; x < descriptorRight && x < imageWidth; x++) { - int index = Numerics.Clamp(Unsafe.Add(ref indicesRowRef, x - descriptorLeft), 0, Math.Max(transIndex, colorTableMaxIdx)); + int index = Numerics.Clamp(Unsafe.Add(ref indicesRowRef, x - descriptorLeft), 0, colorTableMaxIdx); ref TPixel pixel = ref Unsafe.Add(ref rowRef, x); Rgb24 rgb = colorTable[index]; pixel.FromRgb24(rgb);