Browse Source

Add test for issue #1942

pull/1944/head
Brian Popow 4 years ago
parent
commit
c476caace6
  1. 12
      tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs
  2. 1
      tests/ImageSharp.Tests/TestImages.cs
  3. 3
      tests/Images/Input/Jpg/issues/Issue1942InvalidIptcTag.jpg

12
tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs

@ -288,5 +288,17 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
Assert.Equal(72, imageInfo.Metadata.HorizontalResolution);
Assert.Equal(72, imageInfo.Metadata.VerticalResolution);
});
[Theory]
[WithFile(TestImages.Jpeg.Issues.InvalidIptcTag, PixelTypes.Rgba32)]
public void Decode_WithInvalidIptcTag_DoesNotThrowException<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
{
Exception ex = Record.Exception(() =>
{
using Image<TPixel> image = provider.GetImage(JpegDecoder);
});
Assert.Null(ex);
}
}
}

1
tests/ImageSharp.Tests/TestImages.cs

@ -261,6 +261,7 @@ namespace SixLabors.ImageSharp.Tests
public const string WrongColorSpace = "Jpg/issues/Issue1732-WrongColorSpace.jpg";
public const string MalformedUnsupportedComponentCount = "Jpg/issues/issue-1900-malformed-unsupported-255-components.jpg";
public const string MultipleApp01932 = "Jpg/issues/issue-1932-app0-resolution.jpg";
public const string InvalidIptcTag = "Jpg/issues/Issue1942InvalidIptcTag.jpg";
public static class Fuzz
{

3
tests/Images/Input/Jpg/issues/Issue1942InvalidIptcTag.jpg

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9c9db428c4d9d7d1aea6778f263d8deaeeabdcfa63c77ef6ce36ab0e47b364dd
size 93374
Loading…
Cancel
Save