From 30fc0810e3f37c1110182be2c7bee83634186757 Mon Sep 17 00:00:00 2001 From: cristy Date: Sat, 14 Feb 2015 15:56:20 +0000 Subject: [PATCH] --- coders/palm.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/coders/palm.c b/coders/palm.c index ab914914c..f95ae8cb6 100644 --- a/coders/palm.c +++ b/coders/palm.c @@ -420,6 +420,8 @@ static Image *ReadPALMImage(const ImageInfo *image_info, for (i=0; i < (ssize_t) bytes_per_row; ) { count=(ssize_t) ReadBlobByte(image); + if (count < 0) + break; count=MagickMin(count,(ssize_t) bytes_per_row-i); byte=(size_t) ReadBlobByte(image); (void) ResetMagickMemory(one_row+i,(int) byte,(size_t) count); @@ -514,6 +516,12 @@ static Image *ReadPALMImage(const ImageInfo *image_info, one_row=(unsigned char *) RelinquishMagickMemory(one_row); if (compressionType == PALM_COMPRESSION_SCANLINE) lastrow=(unsigned char *) RelinquishMagickMemory(lastrow); + if (EOFBlob(image) != MagickFalse) + { + ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile", + image->filename); + break; + } /* Proceed to next image. Copied from coders/pnm.c */ -- 2.40.0