Skip to content

Commit

Permalink
Merge pull request #2594 from SixLabors/js/fix-2517-jpeg
Browse files Browse the repository at this point in the history
Confirm we can correctly decode jpegs with malformed D0-D7 chunks.
  • Loading branch information
JimBobSquarePants authored Nov 30, 2023
2 parents e69e622 + 2200ac2 commit 83322e3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,4 +353,15 @@ public void DecodeHang<TPixel>(TestImageProvider<TPixel> provider)
Assert.Equal(65503, image.Width);
Assert.Equal(65503, image.Height);
}

// https://github.com/SixLabors/ImageSharp/issues/2517
[Theory]
[WithFile(TestImages.Jpeg.Issues.Issue2517, PixelTypes.Rgba32)]
public void Issue2517_DecodeWorks<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
{
using Image<TPixel> image = provider.GetImage(JpegDecoder.Instance);
image.DebugSave(provider);
image.CompareToOriginal(provider);
}
}
1 change: 1 addition & 0 deletions tests/ImageSharp.Tests/TestImages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ public static class Issues
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 const string Issue2517 = "Jpg/issues/issue2517-bad-d7.jpg";

public static class Fuzz
{
Expand Down
3 changes: 3 additions & 0 deletions tests/Images/Input/Jpg/issues/issue2517-bad-d7.jpg
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 83322e3

Please sign in to comment.