Skip to content

Commit 6b2030b

Browse files
authored
Merge branch 'release/2.1.x' into af/backport-2759-2.1.x
2 parents 8ffad3f + a1f2879 commit 6b2030b

File tree

11 files changed

+51
-0
lines changed

11 files changed

+51
-0
lines changed

tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs

+11
Original file line numberDiff line numberDiff line change
@@ -306,5 +306,16 @@ public void IssueDeferredClearCode<TPixel>(TestImageProvider<TPixel> provider)
306306
image.DebugSave(provider);
307307
image.CompareFirstFrameToReferenceOutput(ImageComparer.Exact, provider);
308308
}
309+
310+
// https://github.com/SixLabors/ImageSharp/issues/2743
311+
[Theory]
312+
[WithFile(TestImages.Gif.Issues.BadMaxLzwBits, PixelTypes.Rgba32)]
313+
public void IssueTooLargeLzwBits<TPixel>(TestImageProvider<TPixel> provider)
314+
where TPixel : unmanaged, IPixel<TPixel>
315+
{
316+
using Image<TPixel> image = provider.GetImage();
317+
image.DebugSaveMultiFrame(provider);
318+
image.CompareToReferenceOutputMultiFrame(provider, ImageComparer.Exact);
319+
}
309320
}
310321
}

tests/ImageSharp.Tests/Formats/Gif/GifMetadataTests.cs

+15
Original file line numberDiff line numberDiff line change
@@ -190,5 +190,20 @@ public void Decode_VerifyRepeatCount(string imagePath, uint repeatCount)
190190
}
191191
}
192192
}
193+
194+
[Theory]
195+
[InlineData(TestImages.Gif.Issues.BadMaxLzwBits, 8)]
196+
[InlineData(TestImages.Gif.Issues.Issue2012BadMinCode, 1)]
197+
public void Identify_Frames_Bad_Lzw(string imagePath, int framesCount)
198+
{
199+
TestFile testFile = TestFile.Create(imagePath);
200+
using MemoryStream stream = new(testFile.Bytes, false);
201+
202+
IImageInfo imageInfo = Image.Identify(stream);
203+
204+
Assert.NotNull(imageInfo);
205+
GifMetadata gifMetadata = imageInfo.Metadata.GetGifMetadata();
206+
Assert.NotNull(gifMetadata);
207+
}
193208
}
194209
}

tests/ImageSharp.Tests/TestImages.cs

+1
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ public static class Issues
456456
public const string BadAppExtLength = "Gif/issues/issue405_badappextlength252.gif";
457457
public const string BadAppExtLength_2 = "Gif/issues/issue405_badappextlength252-2.gif";
458458
public const string BadDescriptorWidth = "Gif/issues/issue403_baddescriptorwidth.gif";
459+
public const string BadMaxLzwBits = "Gif/issues/issue_2743.gif";
459460
public const string DeferredClearCode = "Gif/issues/bugzilla-55918.gif";
460461
public const string Issue1505 = "Gif/issues/issue1505_argumentoutofrange.png";
461462
public const string Issue1530 = "Gif/issues/issue1530.gif";
Loading

0 commit comments

Comments
 (0)