]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Thu, 2 Feb 2012 02:26:18 +0000 (02:26 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Thu, 2 Feb 2012 02:26:18 +0000 (02:26 +0000)
MagickCore/property.c

index 1a6e6fa9fb2a4fb2696781c876f034420c200a13..415ea62ac219eba424a0abfff3e11f391f186b1e 100644 (file)
@@ -1110,6 +1110,9 @@ static MagickBooleanType GetEXIFProperty(const Image *image,
     tag_offset,
     tag;
 
+  SplayTreeInfo
+    *exif_resources;
+
   ssize_t
     all,
     id,
@@ -1255,7 +1258,9 @@ static MagickBooleanType GetEXIFProperty(const Image *image,
   level=0;
   entry=0;
   tag_offset=0;
-  for (i=0; i < 1024; i++)
+  exif_resources=NewSplayTree((int (*)(const void *,const void *)) NULL,
+    (void *(*)(void *)) NULL,(void *(*)(void *)) NULL);
+  do
   {
     /*
       If there is anything on the stack then pop it off.
@@ -1285,6 +1290,9 @@ static MagickBooleanType GetEXIFProperty(const Image *image,
         components;
 
       q=(unsigned char *) (directory+(12*entry)+2);
+      if (GetValueFromSplayTree(exif_resources,q) == q)
+        break;
+      (void) AddValueToSplayTree(exif_resources,q,q);
       tag_value=(ssize_t) ((int) ReadPropertyShort(endian,q)+tag_offset);
       format=(size_t) ((int) ReadPropertyShort(endian,q+2));
       if (format >= (sizeof(tag_bytes)/sizeof(*tag_bytes)))
@@ -1490,9 +1498,8 @@ static MagickBooleanType GetEXIFProperty(const Image *image,
             break;
           }
     }
-    if (level <= 0)
-      break;
-  }
+  } while (level > 0);
+  exif_resources=DestroySplayTree(exif_resources);
   return(status);
 }