]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Fri, 9 Jan 2015 12:13:22 +0000 (12:13 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Fri, 9 Jan 2015 12:13:22 +0000 (12:13 +0000)
12 files changed:
coders/aai.c
coders/bmp.c
coders/dds.c
coders/jp2.c
coders/pcd.c
coders/pnm.c
coders/pwp.c
coders/rle.c
coders/tga.c
coders/tiff.c
coders/xcf.c
coders/xwd.c

index 0f34b75e412220f69246d672b5fcdb8f09a01bb3..a069a636a9bcaefe08c2ee64e68d3ce5938031e6 100644 (file)
@@ -170,7 +170,7 @@ static Image *ReadAAIImage(const ImageInfo *image_info,ExceptionInfo *exception)
     for (y=0; y < (ssize_t) image->rows; y++)
     {
       count=ReadBlob(image,length,pixels);
-      if ((size_t) count != length)
+      if (count != (ssize_t) length)
         ThrowReaderException(CorruptImageError,"UnableToReadImageData");
       p=pixels;
       q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
index 1df0a492f3b147057786769c6a616fa255531f44..d8e4ff85d03c544298d94a95c91fee91c35962ef 100644 (file)
@@ -547,6 +547,8 @@ static Image *ReadBMPImage(const ImageInfo *image_info,ExceptionInfo *exception)
   bmp_info.ba_offset=0;
   start_position=0;
   count=ReadBlob(image,2,magick);
+  if (count != 2)
+    ThrowReaderException(CorruptImageError,"ImproperImageHeader");
   do
   {
     PixelInfo
index d8319bd4b10582f924813e7ccf089e905d5f5db3..f9a3ed1286b8e1680fe91074f9a885dedf04e2b6 100644 (file)
@@ -2553,7 +2553,7 @@ static void WriteCompressed(Image *image, const size_t count,
   ComputeWeightedCovariance(count,points,covariance);
   ComputePrincipleComponent(covariance,&principle);
 
-  if (clusterFit == MagickFalse || count == 0)
+  if ((clusterFit == MagickFalse) || (count == 0))
     CompressRangeFit(count,points,map,principle,metric,&start,&end,indices);
   else
     CompressClusterFit(count,points,map,principle,metric,&start,&end,indices);
index 0ec43c605fc9b5e25408fe1393fce40602ce031f..27ae32748d01581ab54627e1178e13d4f3f29279 100644 (file)
@@ -204,7 +204,7 @@ static OPJ_SIZE_T JP2ReadHandler(void *buffer,OPJ_SIZE_T length,void *context)
 
   image=(Image *) context;
   count=ReadBlob(image,(ssize_t) length,(unsigned char *) buffer);
-  if (count == 0)
+  if (count != (ssize_t) length)
     return((OPJ_SIZE_T) -1);
   return((OPJ_SIZE_T) count);
 }
index 1586f2975e5c453159f276eb49490c3e6b4ebd9b..7c904e9429c18cd8b64a6ad8271d2ce202f98035 100644 (file)
@@ -539,7 +539,7 @@ static Image *ReadPCDImage(const ImageInfo *image_info,ExceptionInfo *exception)
     ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
   count=ReadBlob(image,3*0x800,header);
   overview=LocaleNCompare((char *) header,"PCD_OPA",7) == 0;
-  if ((count == 0) ||
+  if ((count != (3*0x800)) ||
       ((LocaleNCompare((char *) header+0x800,"PCD",3) != 0) && (overview ==0)))
     ThrowReaderException(CorruptImageError,"ImproperImageHeader");
   rotate=header[0x0e02] & 0x03;
index 5078e4afa2688423470a4a853945c04752a3a647..0ed69f143ccf3b019fbb0dceaf45892def1a82d3 100644 (file)
@@ -1348,9 +1348,9 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
           Skip to end of line.
         */
         count=ReadBlob(image,1,(unsigned char *) &format);
-        if (count == 0)
+        if (count != 1)
           break;
-        if ((count != 0) && (format == 'P'))
+        if (format == 'P')
           break;
       } while (format != '\n');
     count=ReadBlob(image,1,(unsigned char *) &format);
index 00a1d328e7eade2a34013a799a47fdc510fd600e..357687d57db03612c1da2403688445248ae5cf72 100644 (file)
@@ -171,7 +171,7 @@ static Image *ReadPWPImage(const ImageInfo *image_info,ExceptionInfo *exception)
   if (status == MagickFalse)
     return((Image *) NULL);
   count=ReadBlob(pwp_image,5,magick);
-  if ((count == 0) || (LocaleNCompare((char *) magick,"SFW95",5) != 0))
+  if ((count != 5) || (LocaleNCompare((char *) magick,"SFW95",5) != 0))
     ThrowReaderException(CorruptImageError,"ImproperImageHeader");
   read_info=CloneImageInfo(image_info);
   (void) SetImageInfoProgressMonitor(read_info,(MagickProgressMonitor) NULL,
index dd77e43c94bf0043c7484d609f5325266f02e663..6af18f494bec4e214626548c86e88cde9f71c6d4 100644 (file)
@@ -209,7 +209,7 @@ static Image *ReadRLEImage(const ImageInfo *image_info,ExceptionInfo *exception)
     Determine if this a RLE file.
   */
   count=ReadBlob(image,2,(unsigned char *) magick);
-  if ((count == 0) || (memcmp(magick,"\122\314",2) != 0))
+  if ((count != 2) || (memcmp(magick,"\122\314",2) != 0))
     ThrowReaderException(CorruptImageError,"ImproperImageHeader");
   do
   {
index 8b614791dc5a33ed1fd6aeddf8ed57e69b7ef17b..852ea9f01a686d680202d71c51b058f8d2efc15f 100644 (file)
@@ -417,7 +417,7 @@ static Image *ReadTGAImage(const ImageInfo *image_info,
           else
             {
               count=ReadBlob(image,1,&runlength);
-              if (count == 0)
+              if (count != 1)
                 ThrowReaderException(CorruptImageError,"UnableToReadImageData");
               flag=runlength & 0x80;
               if (flag != 0)
index ec27e9d158a4202a8c15a0a067a867dd47508d58..54edc917353b94e3538b04fb880200bb3b7c90f3 100644 (file)
@@ -2063,7 +2063,7 @@ static void TIFFIgnoreTags(TIFF *tiff)
   i=0;
   p=tags;
   ignore=(TIFFFieldInfo *) AcquireQuantumMemory(count,sizeof(*ignore));
-  // This also sets field_bit to 0 (FIELD_IGNORE)
+  /* This also sets field_bit to 0 (FIELD_IGNORE) */
   ResetMagickMemory(ignore,0,count*sizeof(*ignore));
   while (*p != '\0')
   {
index 577bdcd28f5963c1e019615e62302bc1638c1601..9821bc315c2cbd0d981a675bfbd275549a7faa0e 100644 (file)
@@ -1022,7 +1022,7 @@ static Image *ReadXCFImage(const ImageInfo *image_info,ExceptionInfo *exception)
       return((Image *) NULL);
     }
   count=ReadBlob(image,14,(unsigned char *) magick);
-  if ((count == 0) ||
+  if ((count != 14) ||
       (LocaleNCompare((char *) magick,"gimp xcf",8) != 0))
     ThrowReaderException(CorruptImageError,"ImproperImageHeader");
   (void) ResetMagickMemory(&doc_info,0,sizeof(XCFDocInfo));
index d9b7d13f4ad56b01625742c8bbe47c315dfb2eb3..f83b4ef031cd9b0e1ba0e14e78d21578642a0860 100644 (file)
@@ -329,7 +329,7 @@ static Image *ReadXWDImage(const ImageInfo *image_info,ExceptionInfo *exception)
       for (i=0; i < (ssize_t) header.ncolors; i++)
       {
         count=ReadBlob(image,sz_XWDColor,(unsigned char *) &color);
-        if (count == 0)
+        if (count != sz_XWDColor)
           {
             ximage=(XImage *) RelinquishMagickMemory(ximage);
             ThrowReaderException(CorruptImageError,"UnexpectedEndOfFile");