]> granicus.if.org Git - imagemagick/commitdiff
...
authorCristy <urban-warrior@imagemagick.org>
Thu, 14 Sep 2017 11:24:45 +0000 (07:24 -0400)
committerCristy <urban-warrior@imagemagick.org>
Thu, 14 Sep 2017 11:24:45 +0000 (07:24 -0400)
coders/cmyk.c

index 7cd6e04e109da9e3608131d11237c9eef20816f3..21c84e480b259c7d9aed0a05c91e757fd949a0e9 100644 (file)
@@ -193,6 +193,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
   count=0;
   length=0;
   scene=0;
+  status=MagickTrue;
   do
   {
     /*
@@ -233,6 +234,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
 
           if (count != (ssize_t) length)
             {
+              status=MagickFalse;
               ThrowFileException(exception,CorruptImageError,
                 "UnexpectedEndOfFile",image->filename);
               break;
@@ -315,6 +317,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
 
           if (count != (ssize_t) length)
             {
+              status=MagickFalse;
               ThrowFileException(exception,CorruptImageError,
                 "UnexpectedEndOfFile",image->filename);
               break;
@@ -414,6 +417,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
 
           if (count != (ssize_t) length)
             {
+              status=MagickFalse;
               ThrowFileException(exception,CorruptImageError,
                 "UnexpectedEndOfFile",image->filename);
               break;
@@ -466,6 +470,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
 
           if (count != (ssize_t) length)
             {
+              status=MagickFalse;
               ThrowFileException(exception,CorruptImageError,
                 "UnexpectedEndOfFile",image->filename);
               break;
@@ -518,6 +523,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
 
           if (count != (ssize_t) length)
             {
+              status=MagickFalse;
               ThrowFileException(exception,CorruptImageError,
                 "UnexpectedEndOfFile",image->filename);
               break;
@@ -570,6 +576,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
 
           if (count != (ssize_t) length)
             {
+              status=MagickFalse;
               ThrowFileException(exception,CorruptImageError,
                 "UnexpectedEndOfFile",image->filename);
               break;
@@ -624,6 +631,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
 
               if (count != (ssize_t) length)
                 {
+                  status=MagickFalse;
                   ThrowFileException(exception,CorruptImageError,
                     "UnexpectedEndOfFile",image->filename);
                   break;
@@ -697,6 +705,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
               GetQuantumPixels(quantum_info),&count);
             if (count != (ssize_t) length)
               {
+                status=MagickFalse;
                 ThrowFileException(exception,CorruptImageError,
                   "UnexpectedEndOfFile",image->filename);
                 break;
@@ -717,6 +726,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
 
           if (count != (ssize_t) length)
             {
+              status=MagickFalse;
               ThrowFileException(exception,CorruptImageError,
                 "UnexpectedEndOfFile",image->filename);
               break;
@@ -773,6 +783,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
               GetQuantumPixels(quantum_info),&count);
             if (count != (ssize_t) length)
               {
+                status=MagickFalse;
                 ThrowFileException(exception,CorruptImageError,
                   "UnexpectedEndOfFile",image->filename);
                 break;
@@ -793,6 +804,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
 
           if (count != (ssize_t) length)
             {
+              status=MagickFalse;
               ThrowFileException(exception,CorruptImageError,
                 "UnexpectedEndOfFile",image->filename);
               break;
@@ -848,7 +860,8 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
             pixels=(const unsigned char *) ReadBlobStream(image,length,
               GetQuantumPixels(quantum_info),&count);
             if (count != (ssize_t) length)
-              {
+              { 
+                status=MagickFalse;
                 ThrowFileException(exception,CorruptImageError,
                   "UnexpectedEndOfFile",image->filename);
                 break;
@@ -869,6 +882,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
 
           if (count != (ssize_t) length)
             {
+              status=MagickFalse;
               ThrowFileException(exception,CorruptImageError,
                 "UnexpectedEndOfFile",image->filename);
               break;
@@ -926,6 +940,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
               GetQuantumPixels(quantum_info),&count);
             if (count != (ssize_t) length)
               {
+                status=MagickFalse;
                 ThrowFileException(exception,CorruptImageError,
                   "UnexpectedEndOfFile",image->filename);
                 break;
@@ -946,6 +961,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
 
           if (count != (ssize_t) length)
             {
+              status=MagickFalse;
               ThrowFileException(exception,CorruptImageError,
                 "UnexpectedEndOfFile",image->filename);
               break;
@@ -1005,6 +1021,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
                   GetQuantumPixels(quantum_info),&count);
                 if (count != (ssize_t) length)
                   {
+                    status=MagickFalse;
                     ThrowFileException(exception,CorruptImageError,
                       "UnexpectedEndOfFile",image->filename);
                     break;
@@ -1026,6 +1043,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
 
               if (count != (ssize_t) length)
                 {
+                  status=MagickFalse;
                   ThrowFileException(exception,CorruptImageError,
                     "UnexpectedEndOfFile",image->filename);
                   break;
@@ -1105,6 +1123,8 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
   quantum_info=DestroyQuantumInfo(quantum_info);
   canvas_image=DestroyImage(canvas_image);
   (void) CloseBlob(image);
+  if (status == MagickFalse)
+    return(DestroyImageList(image));
   return(GetFirstImageInList(image));
 }
 \f