Skip to content

Commit

Permalink
Merge pull request #1226 from SixLabors/js/issue-1211
Browse files Browse the repository at this point in the history
Only throw for multi SOF when fully decoding.
  • Loading branch information
JimBobSquarePants authored Jun 12, 2020
2 parents 2fbb450 + c163879 commit 0890bca
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,11 @@ private void ProcessStartOfFrameMarker(int remaining, in JpegFileMarker frameMar
{
if (this.Frame != null)
{
if (metadataOnly)
{
return;
}

JpegThrowHelper.ThrowInvalidImageContentException("Multiple SOF markers. Only single frame jpegs supported.");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public partial class JpegDecoderTests
{ 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 =
Expand Down
1 change: 1 addition & 0 deletions tests/ImageSharp.Tests/TestImages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ public static class Issues
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
{
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0890bca

Please sign in to comment.