gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r8402 - Extractor/src/plugins


From: gnunet
Subject: [GNUnet-SVN] r8402 - Extractor/src/plugins
Date: Wed, 8 Apr 2009 21:05:47 -0600

Author: grothoff
Date: 2009-04-08 21:05:47 -0600 (Wed, 08 Apr 2009)
New Revision: 8402

Modified:
   Extractor/src/plugins/tiffextractor.c
Log:
fixes

Modified: Extractor/src/plugins/tiffextractor.c
===================================================================
--- Extractor/src/plugins/tiffextractor.c       2009-04-08 17:56:48 UTC (rev 
8401)
+++ Extractor/src/plugins/tiffextractor.c       2009-04-09 03:05:47 UTC (rev 
8402)
@@ -114,9 +114,9 @@
   TIFF_HEADER hdr;
   int byteOrder;                /* 0: do not convert;
                                    1: do convert */
-  int current_ifd;
-  long long length = -1;
-  long long width = -1;
+  unsigned int current_ifd;
+  unsigned int length = -1;
+  unsigned int width = -1;
 
   if (size < TIFF_HEADER_SIZE)
     return prev;                /*  can not be tiff */
@@ -141,7 +141,8 @@
       unsigned short len;
       unsigned int off;
       int i;
-      if (current_ifd + 6 > size)
+      if ( (current_ifd + 6 > size) ||
+          (current_ifd + 6 < current_ifd) )
         return prev;
       if (byteOrder == 0)
         len = data[current_ifd + 1] << 8 | data[current_ifd];
@@ -177,7 +178,7 @@
                 {
                   char tmp[128];
                   snprintf (tmp, 128, "%ux%u",
-                           (unsigned int) width, (unsigned int) length);
+                           width, length);
                   addKeyword (&prev, strdup (tmp), EXTRACTOR_SIZE);
                 }
               break;
@@ -190,7 +191,7 @@
                 {
                   char tmp[128];
                   snprintf (tmp, 128, "%ux%u",
-                           (unsigned int) width, (unsigned int) length);
+                           width, length);
                   addKeyword (&prev, strdup (tmp), EXTRACTOR_SIZE);
                 }
               break;
@@ -224,14 +225,12 @@
       off = current_ifd + 2 + DIRECTORY_ENTRY_SIZE * len;
       if (byteOrder == 0)
         current_ifd =
-          data[off + 3] << 24 | data[off + 2] << 16 | data[off +
-                                                           1] << 8 |
-          data[off];
+          data[off + 3] << 24 | data[off + 2] << 16 | 
+         data[off + 1] << 8  | data[off];
       else
         current_ifd =
-          data[off] << 24 | data[off + 1] << 16 | data[off +
-                                                       2] << 8 | data[off +
-                                                                      3];
+          data[off] << 24 | data[off + 1] << 16 |
+         data[off + 2] << 8 | data[off + 3];
     }
   return prev;
 }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]