From 049c75f58f007eafdcc61d84b5771419bb2d839a Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Wed, 21 Dec 2016 12:14:11 +1100 Subject: [PATCH] Ensure rented arrays are cleared --- src/ImageSharp/Formats/Gif/LzwDecoder.cs | 4 ++++ src/ImageSharp/Formats/Gif/LzwEncoder.cs | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/ImageSharp/Formats/Gif/LzwDecoder.cs b/src/ImageSharp/Formats/Gif/LzwDecoder.cs index 001f775ed..f43bae5b3 100644 --- a/src/ImageSharp/Formats/Gif/LzwDecoder.cs +++ b/src/ImageSharp/Formats/Gif/LzwDecoder.cs @@ -71,6 +71,10 @@ namespace ImageSharp.Formats this.prefix = ArrayPool.Shared.Rent(MaxStackSize); this.suffix = ArrayPool.Shared.Rent(MaxStackSize); this.pixelStack = ArrayPool.Shared.Rent(MaxStackSize + 1); + + Array.Clear(this.prefix, 0, MaxStackSize); + Array.Clear(this.suffix, 0, MaxStackSize); + Array.Clear(this.pixelStack, 0, MaxStackSize + 1); } /// diff --git a/src/ImageSharp/Formats/Gif/LzwEncoder.cs b/src/ImageSharp/Formats/Gif/LzwEncoder.cs index 4cc125e2f..69419444f 100644 --- a/src/ImageSharp/Formats/Gif/LzwEncoder.cs +++ b/src/ImageSharp/Formats/Gif/LzwEncoder.cs @@ -200,6 +200,8 @@ namespace ImageSharp.Formats this.hashTable = ArrayPool.Shared.Rent(HashSize); this.codeTable = ArrayPool.Shared.Rent(HashSize); + Array.Clear(this.hashTable, 0, HashSize); + Array.Clear(this.codeTable, 0, HashSize); } ///