Browse Source

fix #385 + add test

af/merge-core
Anton Firszov 8 years ago
parent
commit
cd71a63113
  1. 3
      src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigJpegScanDecoder.cs
  2. 2
      tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs
  3. 1
      tests/ImageSharp.Tests/TestImages.cs
  4. 2
      tests/Images/External
  5. 3
      tests/Images/Input/Jpg/issues/Issue385-BadZigZag-Progressive.jpg

3
src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigJpegScanDecoder.cs

@ -583,7 +583,8 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
}
zig = this.RefineNonZeroes(ref bp, zig, val0, delta);
if (bp.ReachedEOF)
if (bp.ReachedEOF || bp.HasError)
{
return;
}

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

@ -50,6 +50,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
TestImages.Jpeg.Progressive.Festzug, TestImages.Jpeg.Progressive.Bad.BadEOF,
TestImages.Jpeg.Issues.BadCoeffsProgressive178,
TestImages.Jpeg.Issues.MissingFF00ProgressiveGirl159,
TestImages.Jpeg.Issues.BadZigZagProgressive385
};
private static readonly Dictionary<string, float> CustomToleranceValues = new Dictionary<string, float>
@ -67,6 +68,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
[TestImages.Jpeg.Progressive.Festzug] = 0.02f / 100,
[TestImages.Jpeg.Progressive.Fb] = 0.16f / 100,
[TestImages.Jpeg.Progressive.Progress] = 0.31f / 100,
[TestImages.Jpeg.Issues.BadZigZagProgressive385] = 0.23f / 100,
};
public const PixelTypes CommonNonDefaultPixelTypes = PixelTypes.Rgba32 | PixelTypes.Argb32 | PixelTypes.RgbaVector;

1
tests/ImageSharp.Tests/TestImages.cs

@ -122,6 +122,7 @@ namespace SixLabors.ImageSharp.Tests
public const string CriticalEOF214 = "Jpg/issues/Issue214-CriticalEOF.jpg";
public const string MissingFF00ProgressiveGirl159 = "Jpg/issues/Issue159-MissingFF00-Progressive-Girl.jpg";
public const string BadCoeffsProgressive178 = "Jpg/issues/Issue178-BadCoeffsProgressive-Lemon.jpg";
public const string BadZigZagProgressive385 = "Jpg/issues/Issue385-BadZigZag-Progressive.jpg";
}
public static readonly string[] All = Baseline.All.Concat(Progressive.All).ToArray();

2
tests/Images/External

@ -1 +1 @@
Subproject commit f99c2ea41419cb3b3e80e5beeab611682252df78
Subproject commit ab7c90362a4881c790c6f264f400dcf4b4dea0ce

3
tests/Images/Input/Jpg/issues/Issue385-BadZigZag-Progressive.jpg

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1052660c765aaad52f7bbad779778b5d15fdc3c92ff4b114c89e579c749c7f6b
size 388517
Loading…
Cancel
Save