From f0aa22ee0d925181672b3c6ca0c5490d8b90a572 Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Tue, 10 Apr 2018 22:38:27 +0200 Subject: [PATCH] Throw exception instead of break (https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7515). --- coders/png.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/coders/png.c b/coders/png.c index 457db712e..4d783615f 100644 --- a/coders/png.c +++ b/coders/png.c @@ -5437,7 +5437,11 @@ static Image *ReadOneMNGImage(MngInfo* mng_info, const ImageInfo *image_info, c=ReadBlobByte(image); if (c == EOF) - break; + { + chunk=(unsigned char *) RelinquishMagickMemory(chunk); + ThrowReaderException(CorruptImageError, + "InsufficientImageDataInFile"); + } chunk[i]=(unsigned char) c; } -- 2.40.0