Browse Source

Ensure rented arrays are cleared

af/merge-core
James Jackson-South 9 years ago
parent
commit
049c75f58f
  1. 4
      src/ImageSharp/Formats/Gif/LzwDecoder.cs
  2. 2
      src/ImageSharp/Formats/Gif/LzwEncoder.cs

4
src/ImageSharp/Formats/Gif/LzwDecoder.cs

@ -71,6 +71,10 @@ namespace ImageSharp.Formats
this.prefix = ArrayPool<int>.Shared.Rent(MaxStackSize);
this.suffix = ArrayPool<int>.Shared.Rent(MaxStackSize);
this.pixelStack = ArrayPool<int>.Shared.Rent(MaxStackSize + 1);
Array.Clear(this.prefix, 0, MaxStackSize);
Array.Clear(this.suffix, 0, MaxStackSize);
Array.Clear(this.pixelStack, 0, MaxStackSize + 1);
}
/// <summary>

2
src/ImageSharp/Formats/Gif/LzwEncoder.cs

@ -200,6 +200,8 @@ namespace ImageSharp.Formats
this.hashTable = ArrayPool<int>.Shared.Rent(HashSize);
this.codeTable = ArrayPool<int>.Shared.Rent(HashSize);
Array.Clear(this.hashTable, 0, HashSize);
Array.Clear(this.codeTable, 0, HashSize);
}
/// <summary>

Loading…
Cancel
Save