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

index 585070c654271b4ed856287bd9a5c97c79cdc5ea..946e5e1b326db12378e1fb802889cee8e921632e 100644 (file)
@@ -200,6 +200,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
   count=0;
   length=0;
   scene=0;
+  status=MagickTrue;
   do
   {
     /*
@@ -231,6 +232,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
         {
           if (count != (ssize_t) length)
             {
+              status=MagickFalse;
               ThrowFileException(exception,CorruptImageError,
                 "UnexpectedEndOfFile",image->filename);
               break;
@@ -304,6 +306,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
           {
             if (count != (ssize_t) length)
               {
+                status=MagickFalse;
                 ThrowFileException(exception,CorruptImageError,
                   "UnexpectedEndOfFile",image->filename);
                 break;
@@ -388,6 +391,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
         {
           if (count != (ssize_t) length)
             {
+              status=MagickFalse;
               ThrowFileException(exception,CorruptImageError,
                 "UnexpectedEndOfFile",image->filename);
               break;
@@ -432,6 +436,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
         {
           if (count != (ssize_t) length)
             {
+              status=MagickFalse;
               ThrowFileException(exception,CorruptImageError,
                 "UnexpectedEndOfFile",image->filename);
               break;
@@ -476,6 +481,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
         {
           if (count != (ssize_t) length)
             {
+              status=MagickFalse;
               ThrowFileException(exception,CorruptImageError,
                 "UnexpectedEndOfFile",image->filename);
               break;
@@ -522,6 +528,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
             {
               if (count != (ssize_t) length)
                 {
+                  status=MagickFalse;
                   ThrowFileException(exception,CorruptImageError,
                     "UnexpectedEndOfFile",image->filename);
                   break;
@@ -596,6 +603,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
               GetQuantumPixels(quantum_info),&count);
             if (count != (ssize_t) length)
               {
+                status=MagickFalse;
                 ThrowFileException(exception,CorruptImageError,
                   "UnexpectedEndOfFile",image->filename);
                 break;
@@ -607,6 +615,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
         {
           if (count != (ssize_t) length)
             {
+              status=MagickFalse;
               ThrowFileException(exception,CorruptImageError,
                 "UnexpectedEndOfFile",image->filename);
               break;
@@ -664,6 +673,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
               GetQuantumPixels(quantum_info),&count);
             if (count != (ssize_t) length)
               {
+                status=MagickFalse;
                 ThrowFileException(exception,CorruptImageError,
                   "UnexpectedEndOfFile",image->filename);
                 break;
@@ -675,6 +685,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
         {
           if (count != (ssize_t) length)
             {
+              status=MagickFalse;
               ThrowFileException(exception,CorruptImageError,
                 "UnexpectedEndOfFile",image->filename);
               break;
@@ -732,6 +743,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
               GetQuantumPixels(quantum_info),&count);
             if (count != (ssize_t) length)
               {
+                status=MagickFalse;
                 ThrowFileException(exception,CorruptImageError,
                   "UnexpectedEndOfFile",image->filename);
                 break;
@@ -743,6 +755,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
         {
           if (count != (ssize_t) length)
             {
+              status=MagickFalse;
               ThrowFileException(exception,CorruptImageError,
                 "UnexpectedEndOfFile",image->filename);
               break;
@@ -802,6 +815,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
                   GetQuantumPixels(quantum_info),&count);
                 if (count != (ssize_t) length)
                   {
+                    status=MagickFalse;
                     ThrowFileException(exception,CorruptImageError,
                       "UnexpectedEndOfFile",image->filename);
                     break;
@@ -813,6 +827,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
             {
               if (count != (ssize_t) length)
                 {
+                  status=MagickFalse;
                   ThrowFileException(exception,CorruptImageError,
                     "UnexpectedEndOfFile",image->filename);
                   break;
@@ -893,6 +908,8 @@ static Image *ReadYCBCRImage(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