From 7525d038cb41979a0e2edfc8273ad8dff7eaa960 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Sun, 21 Aug 2016 14:10:59 +1000 Subject: [PATCH] Don't attempt to read chunks with bad length Fix #460 Former-commit-id: 86da0c1812ebb3db389d271edf6e8ca81167ba60 Former-commit-id: 93b28d11ed01296011abb4eb6bcb03c89e61ad49 Former-commit-id: 0ecfd461c9a6b5b2fe9aa8632534f8cbd5e0166c --- src/ImageProcessorCore/Formats/Png/PngDecoderCore.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ImageProcessorCore/Formats/Png/PngDecoderCore.cs b/src/ImageProcessorCore/Formats/Png/PngDecoderCore.cs index a90f9cb8e..f97e085d5 100644 --- a/src/ImageProcessorCore/Formats/Png/PngDecoderCore.cs +++ b/src/ImageProcessorCore/Formats/Png/PngDecoderCore.cs @@ -413,6 +413,11 @@ namespace ImageProcessorCore.Formats return null; } + if (chunk.Length <= 0) + { + return null; + } + byte[] typeBuffer = this.ReadChunkType(chunk); this.ReadChunkData(chunk);