Skip to content

Commit 0890bca

Browse files
Merge pull request #1226 from SixLabors/js/issue-1211
Only throw for multi SOF when fully decoding.
2 parents 2fbb450 + c163879 commit 0890bca

File tree

4 files changed

+7
-0
lines changed

4 files changed

+7
-0
lines changed

src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,11 @@ private void ProcessStartOfFrameMarker(int remaining, in JpegFileMarker frameMar
812812
{
813813
if (this.Frame != null)
814814
{
815+
if (metadataOnly)
816+
{
817+
return;
818+
}
819+
815820
JpegThrowHelper.ThrowInvalidImageContentException("Multiple SOF markers. Only single frame jpegs supported.");
816821
}
817822

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public partial class JpegDecoderTests
3838
{ true, TestImages.Jpeg.Baseline.Jpeg400, 8, false, false },
3939
{ true, TestImages.Jpeg.Baseline.Snake, 24, true, true },
4040
{ true, TestImages.Jpeg.Baseline.Jpeg420Exif, 24, true, false },
41+
{ true, TestImages.Jpeg.Issues.IdentifyMultiFrame1211, 24, true, true },
4142
};
4243

4344
public static readonly TheoryData<string, int, int, PixelResolutionUnit> RatioFiles =

tests/ImageSharp.Tests/TestImages.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ public static class Issues
229229
public const string IncorrectResize1006 = "Jpg/issues/issue1006-incorrect-resize.jpg";
230230
public const string ExifResize1049 = "Jpg/issues/issue1049-exif-resize.jpg";
231231
public const string BadSubSampling1076 = "Jpg/issues/issue-1076-invalid-subsampling.jpg";
232+
public const string IdentifyMultiFrame1211 = "Jpg/issues/issue-1221-identify-multi-frame.jpg";
232233

233234
public static class Fuzz
234235
{
2.16 MB
Loading

0 commit comments

Comments
 (0)