Skip to content

Commit 2a572d1

Browse files
Merge pull request #2566 from JoseEliasSantos/MakerProfileResolver
[fix]: Fixed Unknown App0 Marker add profileResolver missing
2 parents cc4c0b1 + 48cecd3 commit 2a572d1

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -753,10 +753,7 @@ private void ProcessApplicationHeaderMarker(BufferedReadStream stream, int remai
753753
Span<byte> temp = stackalloc byte[2 * 16 * 4];
754754

755755
stream.Read(temp, 0, JFifMarker.Length);
756-
if (!JFifMarker.TryParse(temp, out this.jFif))
757-
{
758-
JpegThrowHelper.ThrowNotSupportedException("Unknown App0 Marker - Expected JFIF.");
759-
}
756+
_ = JFifMarker.TryParse(temp, out this.jFif);
760757

761758
remaining -= JFifMarker.Length;
762759

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,17 @@ public void Issue2478_DecodeWorks<TPixel>(TestImageProvider<TPixel> provider)
326326
image.CompareToOriginal(provider);
327327
}
328328

329+
// https://github.com/SixLabors/ImageSharp/discussions/2564
330+
[Theory]
331+
[WithFile(TestImages.Jpeg.Issues.Issue2564, PixelTypes.Rgba32)]
332+
public void Issue2564_DecodeWorks<TPixel>(TestImageProvider<TPixel> provider)
333+
where TPixel : unmanaged, IPixel<TPixel>
334+
{
335+
using Image<TPixel> image = provider.GetImage(JpegDecoder.Instance);
336+
image.DebugSave(provider);
337+
image.CompareToOriginal(provider);
338+
}
339+
329340
[Theory]
330341
[WithFile(TestImages.Jpeg.Issues.HangBadScan, PixelTypes.L8)]
331342
public void DecodeHang<TPixel>(TestImageProvider<TPixel> provider)

tests/ImageSharp.Tests/TestImages.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ public static class Issues
302302
public const string Issue2334_NotEnoughBytesA = "Jpg/issues/issue-2334-a.jpg";
303303
public const string Issue2334_NotEnoughBytesB = "Jpg/issues/issue-2334-b.jpg";
304304
public const string Issue2478_JFXX = "Jpg/issues/issue-2478-jfxx.jpg";
305+
public const string Issue2564 = "Jpg/issues/issue-2564.jpg";
305306
public const string HangBadScan = "Jpg/issues/Hang_C438A851.jpg";
306307

307308
public static class Fuzz
Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)