Browse Source
Merge pull request #2566 from JoseEliasSantos/MakerProfileResolver
[fix]: Fixed Unknown App0 Marker add profileResolver missing
pull/2594/head
James Jackson-South
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
16 additions and
4 deletions
-
src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs
-
tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs
-
tests/ImageSharp.Tests/TestImages.cs
-
tests/Images/Input/Jpg/issues/issue-2564.jpg
|
|
|
@ -753,10 +753,7 @@ internal sealed class JpegDecoderCore : IRawJpegData, IImageDecoderInternals |
|
|
|
Span<byte> temp = stackalloc byte[2 * 16 * 4]; |
|
|
|
|
|
|
|
stream.Read(temp, 0, JFifMarker.Length); |
|
|
|
if (!JFifMarker.TryParse(temp, out this.jFif)) |
|
|
|
{ |
|
|
|
JpegThrowHelper.ThrowNotSupportedException("Unknown App0 Marker - Expected JFIF."); |
|
|
|
} |
|
|
|
_ = JFifMarker.TryParse(temp, out this.jFif); |
|
|
|
|
|
|
|
remaining -= JFifMarker.Length; |
|
|
|
|
|
|
|
|
|
|
|
@ -326,6 +326,17 @@ public partial class JpegDecoderTests |
|
|
|
image.CompareToOriginal(provider); |
|
|
|
} |
|
|
|
|
|
|
|
// https://github.com/SixLabors/ImageSharp/discussions/2564
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Jpeg.Issues.Issue2564, PixelTypes.Rgba32)] |
|
|
|
public void Issue2564_DecodeWorks<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> |
|
|
|
{ |
|
|
|
using Image<TPixel> image = provider.GetImage(JpegDecoder.Instance); |
|
|
|
image.DebugSave(provider); |
|
|
|
image.CompareToOriginal(provider); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Jpeg.Issues.HangBadScan, PixelTypes.L8)] |
|
|
|
public void DecodeHang<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
|
|
|
|
@ -302,6 +302,7 @@ public static class TestImages |
|
|
|
public const string Issue2334_NotEnoughBytesA = "Jpg/issues/issue-2334-a.jpg"; |
|
|
|
public const string Issue2334_NotEnoughBytesB = "Jpg/issues/issue-2334-b.jpg"; |
|
|
|
public const string Issue2478_JFXX = "Jpg/issues/issue-2478-jfxx.jpg"; |
|
|
|
public const string Issue2564 = "Jpg/issues/issue-2564.jpg"; |
|
|
|
public const string HangBadScan = "Jpg/issues/Hang_C438A851.jpg"; |
|
|
|
|
|
|
|
public static class Fuzz |
|
|
|
|
|
|
|
@ -0,0 +1,3 @@ |
|
|
|
version https://git-lfs.github.com/spec/v1 |
|
|
|
oid sha256:08f215c777b6fe8e315f18b7f93611c90fa86fefb8e3d37181890afb3068d8bd |
|
|
|
size 939150 |