Browse Source
Merge branch 'master' into js/faster-transforms
af/octree-no-pixelmap
James Jackson-South
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
22 additions and
4 deletions
-
src/ImageSharp/Formats/Png/PngDecoderCore.cs
-
tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs
-
tests/ImageSharp.Tests/TestImages.cs
-
tests/Images/Input/Png/issues/Issue_1127.png
|
|
|
@ -1101,10 +1101,7 @@ namespace SixLabors.ImageSharp.Formats.Png |
|
|
|
|
|
|
|
while (length < 0 || length > (this.currentStream.Length - this.currentStream.Position)) |
|
|
|
{ |
|
|
|
// Not a valid chunk so we skip back all but one of the four bytes we have just read.
|
|
|
|
// That lets us read one byte at a time until we reach a known chunk.
|
|
|
|
this.currentStream.Position -= 3; |
|
|
|
|
|
|
|
// Not a valid chunk so try again until we reach a known chunk.
|
|
|
|
if (!this.TryReadChunkLength(out length)) |
|
|
|
{ |
|
|
|
chunk = default; |
|
|
|
|
|
|
|
@ -243,6 +243,23 @@ namespace SixLabors.ImageSharp.Tests.Formats.Png |
|
|
|
Assert.Null(ex); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Png.Issue1127, PixelTypes.Rgba32)] |
|
|
|
public void Issue1127<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
|
{ |
|
|
|
System.Exception ex = Record.Exception( |
|
|
|
() => |
|
|
|
{ |
|
|
|
using (Image<TPixel> image = provider.GetImage(PngDecoder)) |
|
|
|
{ |
|
|
|
image.DebugSave(provider); |
|
|
|
image.CompareToOriginal(provider, ImageComparer.Exact); |
|
|
|
} |
|
|
|
}); |
|
|
|
Assert.Null(ex); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Png.Splash, PixelTypes.Rgba32)] |
|
|
|
[WithFile(TestImages.Png.Bike, PixelTypes.Rgba32)] |
|
|
|
|
|
|
|
@ -90,6 +90,7 @@ namespace SixLabors.ImageSharp.Tests |
|
|
|
public const string Issue1014_4 = "Png/issues/Issue_1014_4.png"; |
|
|
|
public const string Issue1014_5 = "Png/issues/Issue_1014_5.png"; |
|
|
|
public const string Issue1014_6 = "Png/issues/Issue_1014_6.png"; |
|
|
|
public const string Issue1127 = "Png/issues/Issue_1127.png"; |
|
|
|
|
|
|
|
public static class Bad |
|
|
|
{ |
|
|
|
|
|
|
|
@ -0,0 +1,3 @@ |
|
|
|
version https://git-lfs.github.com/spec/v1 |
|
|
|
oid sha256:9913e68387bb596198089315ffd8e01d27356493f78b26add68b5cf37183b239 |
|
|
|
size 13855 |