From f66ab157f023e1ca37a4c40bd80fd5217d30ba1f Mon Sep 17 00:00:00 2001 From: Cristy Date: Tue, 20 Sep 2016 12:09:01 -0400 Subject: [PATCH] https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=30506 --- coders/dib.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/coders/dib.c b/coders/dib.c index cc4dd3af9..30ae752eb 100644 --- a/coders/dib.c +++ b/coders/dib.c @@ -648,7 +648,10 @@ static Image *ReadDIBImage(const ImageInfo *image_info,ExceptionInfo *exception) { count=ReadBlob(image,length,pixels); if (count != (ssize_t) (length)) - ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile"); + { + pixel_info=RelinquishVirtualMemory(pixel_info); + ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile"); + } } else { @@ -658,7 +661,11 @@ static Image *ReadDIBImage(const ImageInfo *image_info,ExceptionInfo *exception) status=DecodeImage(image,dib_info.compression ? MagickTrue : MagickFalse, pixels); if (status == MagickFalse) - ThrowReaderException(CorruptImageError,"UnableToRunlengthDecodeImage"); + { + pixel_info=RelinquishVirtualMemory(pixel_info); + ThrowReaderException(CorruptImageError, + "UnableToRunlengthDecodeImage"); + } } /* Initialize image structure. @@ -877,6 +884,7 @@ static Image *ReadDIBImage(const ImageInfo *image_info,ExceptionInfo *exception) break; } default: + pixel_info=RelinquishVirtualMemory(pixel_info); ThrowReaderException(CorruptImageError,"ImproperImageHeader"); } pixel_info=RelinquishVirtualMemory(pixel_info); -- 2.40.0