]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sat, 14 Feb 2015 15:56:20 +0000 (15:56 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sat, 14 Feb 2015 15:56:20 +0000 (15:56 +0000)
coders/palm.c

index ab914914c9b886695845e66f54bb6a8025eaab4f..f95ae8cb6b50989d6fd0f486d233e92e079590ac 100644 (file)
@@ -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
     */