]> granicus.if.org Git - imagemagick/commitdiff
http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=26789
authorcristy <urban-warrior@git.imagemagick.org>
Sun, 28 Dec 2014 19:27:24 +0000 (19:27 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sun, 28 Dec 2014 19:27:24 +0000 (19:27 +0000)
coders/cin.c

index 81c9b8f2969c6eb75f072a2886c175f5fd4de3ab..e64afacf431fc0ecf4dfe060a8e7b00c59f7ca41 100644 (file)
@@ -712,8 +712,6 @@ static Image *ReadCINImage(const ImageInfo *image_info,ExceptionInfo *exception)
       (void) SetImageProfile(image,"dpx:user.data",profile,exception);
       profile=DestroyStringInfo(profile);
     }
-  for ( ; offset < (MagickOffsetType) cin.file.image_offset; offset++)
-    (void) ReadBlobByte(image);
   image->depth=cin.image.channel[0].bits_per_pixel;
   image->columns=cin.image.channel[0].pixels_per_line;
   image->rows=cin.image.channel[0].lines_per_image;
@@ -722,6 +720,17 @@ static Image *ReadCINImage(const ImageInfo *image_info,ExceptionInfo *exception)
       (void) CloseBlob(image);
       return(image);
     }
+  for ( ; offset < (MagickOffsetType) cin.file.image_offset; offset++)
+  {
+    int
+      c;
+
+    c=ReadBlobByte(image);
+    if (c == EOF)
+      break;
+  }
+  if (offset < (MagickOffsetType) cin.file.image_offset)
+    ThrowReaderException(CorruptImageError,"ImproperImageHeader");
   status=SetImageExtent(image,image->columns,image->rows,exception);
   if (status == MagickFalse)
     return(DestroyImageList(image));