]> granicus.if.org Git - imagemagick/commitdiff
Earlier check for EOF
authorCristy <urban-warrior@imagemagick.org>
Fri, 3 Jun 2016 20:48:12 +0000 (16:48 -0400)
committerCristy <urban-warrior@imagemagick.org>
Fri, 3 Jun 2016 20:48:12 +0000 (16:48 -0400)
coders/pnm.c

index 0d1a72ed4c2f6255376ea9dc13303ceae2892325..4f5a5b0a141b1326e87199b045f20f1b041aeec6 100644 (file)
@@ -452,6 +452,8 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
           {
             SetPixelGray(image,PNMInteger(image,2,exception) == 0 ?
               QuantumRange : 0,q);
+            if (EOFBlob(image) != MagickFalse)
+              break;
             q+=GetPixelChannels(image);
           }
           if (SyncAuthenticPixels(image,exception) == MagickFalse)
@@ -463,6 +465,8 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
               if (status == MagickFalse)
                 break;
             }
+          if (EOFBlob(image) != MagickFalse)
+            break;
         }
         image->type=BilevelType;
         break;
@@ -491,6 +495,8 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
           {
             intensity=ScaleAnyToQuantum(PNMInteger(image,10,exception),
               max_value);
+            if (EOFBlob(image) != MagickFalse)
+              break;
             SetPixelGray(image,intensity,q);
             q+=GetPixelChannels(image);
           }
@@ -503,6 +509,8 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
               if (status == MagickFalse)
                 break;
             }
+          if (EOFBlob(image) != MagickFalse)
+            break;
         }
         image->type=GrayscaleType;
         break;
@@ -529,6 +537,8 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
               pixel;
 
             pixel=ScaleAnyToQuantum(PNMInteger(image,10,exception),max_value);
+            if (EOFBlob(image) != MagickFalse)
+              break;
             SetPixelRed(image,pixel,q);
             pixel=ScaleAnyToQuantum(PNMInteger(image,10,exception),max_value);
             SetPixelGreen(image,pixel,q);
@@ -545,6 +555,8 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
               if (status == MagickFalse)
                 break;
             }
+          if (EOFBlob(image) != MagickFalse)
+            break;
         }
         break;
       }