From 727a9bcd16f078b63fbb8a64477ad54dc0e09a9c Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Sat, 20 Jan 2018 10:08:44 +0100 Subject: [PATCH] Throw exception when the image does not contain a data chunk (#441). --- src/ImageSharp/Formats/Png/PngDecoderCore.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ImageSharp/Formats/Png/PngDecoderCore.cs b/src/ImageSharp/Formats/Png/PngDecoderCore.cs index 5cdf80289..41f303093 100644 --- a/src/ImageSharp/Formats/Png/PngDecoderCore.cs +++ b/src/ImageSharp/Formats/Png/PngDecoderCore.cs @@ -269,6 +269,11 @@ namespace SixLabors.ImageSharp.Formats.Png } } + if (image == null) + { + throw new ImageFormatException("PNG Image does not contain a data chunk"); + } + return image; } finally