James Jackson-South
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
11 additions and
6 deletions
-
src/ImageSharp/Formats/Png/Zlib/ZlibInflateStream.cs
-
tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs
-
tests/ImageSharp.Tests/TestImages.cs
-
tests/Images/Input/Png/zlib-overflow2.png
|
|
|
@ -1,4 +1,4 @@ |
|
|
|
// Copyright (c) Six Labors and contributors.
|
|
|
|
// Copyright (c) Six Labors and contributors.
|
|
|
|
// Licensed under the Apache License, Version 2.0.
|
|
|
|
|
|
|
|
using System; |
|
|
|
@ -140,7 +140,7 @@ namespace SixLabors.ImageSharp.Formats.Png.Zlib |
|
|
|
|
|
|
|
offset += bytesRead; |
|
|
|
|
|
|
|
if (offset >= length) |
|
|
|
if (offset >= length || offset >= count) |
|
|
|
{ |
|
|
|
return bytesRead; |
|
|
|
} |
|
|
|
@ -249,4 +249,4 @@ namespace SixLabors.ImageSharp.Formats.Png.Zlib |
|
|
|
this.compressedStream = new DeflateStream(this, CompressionMode.Decompress, true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -1,4 +1,4 @@ |
|
|
|
// Copyright (c) Six Labors and contributors.
|
|
|
|
// Copyright (c) Six Labors and contributors.
|
|
|
|
// Licensed under the Apache License, Version 2.0.
|
|
|
|
|
|
|
|
// ReSharper disable InconsistentNaming
|
|
|
|
@ -42,7 +42,8 @@ namespace SixLabors.ImageSharp.Tests.Formats.Png |
|
|
|
TestImages.Png.Rgb24BppTrans, |
|
|
|
TestImages.Png.GrayAlpha8Bit, |
|
|
|
TestImages.Png.Gray1BitTrans, |
|
|
|
TestImages.Png.Bad.ZlibOverflow |
|
|
|
TestImages.Png.Bad.ZlibOverflow, |
|
|
|
TestImages.Png.Bad.ZlibOverflow2 |
|
|
|
}; |
|
|
|
|
|
|
|
public static readonly string[] TestImages48Bpp = |
|
|
|
@ -294,4 +295,4 @@ namespace SixLabors.ImageSharp.Tests.Formats.Png |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -87,6 +87,7 @@ namespace SixLabors.ImageSharp.Tests |
|
|
|
public const string ChunkLength2 = "Png/chunklength2.png"; |
|
|
|
public const string CorruptedChunk = "Png/big-corrupted-chunk.png"; |
|
|
|
public const string ZlibOverflow = "Png/zlib-overflow.png"; |
|
|
|
public const string ZlibOverflow2 = "Png/zlib-overflow2.png"; |
|
|
|
} |
|
|
|
|
|
|
|
public static readonly string[] All = |
|
|
|
|
|
|
|
@ -0,0 +1,3 @@ |
|
|
|
version https://git-lfs.github.com/spec/v1 |
|
|
|
oid sha256:3994ef9f044fd589a412409b35cf23d346da43af0d82e25f2c11a36b464c7599 |
|
|
|
size 16887 |