From: cristy Date: Sat, 14 Feb 2015 15:56:20 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~1288 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=30fc0810e3f37c1110182be2c7bee83634186757;p=imagemagick --- 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 */