diff --git a/src/ImageSharp/Formats/Png/PngDecoderCore.cs b/src/ImageSharp/Formats/Png/PngDecoderCore.cs
index f31af2b49d..4d581b2b6e 100644
--- a/src/ImageSharp/Formats/Png/PngDecoderCore.cs
+++ b/src/ImageSharp/Formats/Png/PngDecoderCore.cs
@@ -44,6 +44,11 @@ namespace ImageSharp.Formats
///
private readonly char[] chars = new char[4];
+ ///
+ /// Reusable crc for validating chunks.
+ ///
+ private readonly Crc32 crc = new Crc32();
+
///
/// The stream to decode from.
///
@@ -594,11 +599,11 @@ namespace ImageSharp.Formats
chunk.Crc = BitConverter.ToUInt32(this.crcBuffer, 0);
- Crc32 crc = new Crc32();
- crc.Update(this.chunkTypeBuffer);
- crc.Update(chunk.Data, 0, chunk.Length);
+ this.crc.Reset();
+ this.crc.Update(this.chunkTypeBuffer);
+ this.crc.Update(chunk.Data, 0, chunk.Length);
- if (crc.Value != chunk.Crc)
+ if (this.crc.Value != chunk.Crc)
{
throw new ImageFormatException("CRC Error. PNG Image chunk is corrupt!");
}