Browse Source
Merge pull request #1532 from SixLabors/js/fix-1530
Sanitize Gif descriptor bounds.
pull/1554/head
James Jackson-South
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with
19 additions and
2 deletions
-
src/ImageSharp/Formats/Gif/GifDecoderCore.cs
-
tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs
-
tests/ImageSharp.Tests/TestImages.cs
-
tests/Images/External
-
tests/Images/Input/Gif/issues/issue1530.gif
|
|
|
@ -535,7 +535,8 @@ namespace SixLabors.ImageSharp.Formats.Gif |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
Buffer2DRegion<TPixel> pixelRegion = frame.PixelBuffer.GetRegion(this.restoreArea.Value); |
|
|
|
var interest = Rectangle.Intersect(frame.Bounds(), this.restoreArea.Value); |
|
|
|
Buffer2DRegion<TPixel> pixelRegion = frame.PixelBuffer.GetRegion(interest); |
|
|
|
pixelRegion.Clear(); |
|
|
|
|
|
|
|
this.restoreArea = null; |
|
|
|
|
|
|
|
@ -171,6 +171,17 @@ namespace SixLabors.ImageSharp.Tests.Formats.Gif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// https://github.com/SixLabors/ImageSharp/issues/1503
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Gif.Issues.Issue1530, PixelTypes.Rgba32)] |
|
|
|
public void Issue1530_BadDescriptorDimensions<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> |
|
|
|
{ |
|
|
|
using Image<TPixel> image = provider.GetImage(); |
|
|
|
image.DebugSaveMultiFrame(provider); |
|
|
|
image.CompareToReferenceOutputMultiFrame(provider, ImageComparer.Exact); |
|
|
|
} |
|
|
|
|
|
|
|
// https://github.com/SixLabors/ImageSharp/issues/405
|
|
|
|
[Theory] |
|
|
|
[WithFile(TestImages.Gif.Issues.BadAppExtLength, PixelTypes.Rgba32)] |
|
|
|
@ -181,6 +192,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Gif |
|
|
|
using (Image<TPixel> image = provider.GetImage()) |
|
|
|
{ |
|
|
|
image.DebugSave(provider); |
|
|
|
|
|
|
|
image.CompareFirstFrameToReferenceOutput(ImageComparer.Exact, provider); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -416,6 +416,7 @@ namespace SixLabors.ImageSharp.Tests |
|
|
|
public const string BadAppExtLength_2 = "Gif/issues/issue405_badappextlength252-2.gif"; |
|
|
|
public const string BadDescriptorWidth = "Gif/issues/issue403_baddescriptorwidth.gif"; |
|
|
|
public const string Issue1505 = "Gif/issues/issue1505_argumentoutofrange.png"; |
|
|
|
public const string Issue1530 = "Gif/issues/issue1530.gif"; |
|
|
|
} |
|
|
|
|
|
|
|
public static readonly string[] All = { Rings, Giphy, Cheers, Trans, Kumin, Leo, Ratio4x1, Ratio1x4 }; |
|
|
|
|
|
|
|
@ -1 +1 @@ |
|
|
|
Subproject commit 346070e5ba538f1a3bbafc0ea7367404c5f8c9ab |
|
|
|
Subproject commit 1df65162448996332449387a46da942e181043c8 |
|
|
|
@ -0,0 +1,3 @@ |
|
|
|
version https://git-lfs.github.com/spec/v1 |
|
|
|
oid sha256:08b33cab34de2622a7d22edff25fe479a5018c2e0fbc65870b2f21ea7901fc61 |
|
|
|
size 1844876 |