Browse Source

Merge pull request #1226 from SixLabors/js/issue-1211

Only throw for multi SOF when fully decoding.
pull/1574/head
James Jackson-South 6 years ago
committed by GitHub
parent
commit
18a5e52d70
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs
  2. 1
      tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs
  3. 1
      tests/ImageSharp.Tests/TestImages.cs
  4. 3
      tests/Images/Input/Jpg/issues/issue-1221-identify-multi-frame.jpg

5
src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs

@ -812,6 +812,11 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
{
if (this.Frame != null)
{
if (metadataOnly)
{
return;
}
JpegThrowHelper.ThrowInvalidImageContentException("Multiple SOF markers. Only single frame jpegs supported.");
}

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

@ -38,6 +38,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
{ true, TestImages.Jpeg.Baseline.Jpeg400, 8, false, false },
{ true, TestImages.Jpeg.Baseline.Snake, 24, true, true },
{ true, TestImages.Jpeg.Baseline.Jpeg420Exif, 24, true, false },
{ true, TestImages.Jpeg.Issues.IdentifyMultiFrame1211, 24, true, true },
};
public static readonly TheoryData<string, int, int, PixelResolutionUnit> RatioFiles =

1
tests/ImageSharp.Tests/TestImages.cs

@ -229,6 +229,7 @@ namespace SixLabors.ImageSharp.Tests
public const string IncorrectResize1006 = "Jpg/issues/issue1006-incorrect-resize.jpg";
public const string ExifResize1049 = "Jpg/issues/issue1049-exif-resize.jpg";
public const string BadSubSampling1076 = "Jpg/issues/issue-1076-invalid-subsampling.jpg";
public const string IdentifyMultiFrame1211 = "Jpg/issues/issue-1221-identify-multi-frame.jpg";
public static class Fuzz
{

3
tests/Images/Input/Jpg/issues/issue-1221-identify-multi-frame.jpg

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