]> granicus.if.org Git - imagemagick/commitdiff
Fixed updating exif profile.
authordirk <dirk@git.imagemagick.org>
Sat, 1 Mar 2014 17:38:22 +0000 (17:38 +0000)
committerdirk <dirk@git.imagemagick.org>
Sat, 1 Mar 2014 17:38:22 +0000 (17:38 +0000)
MagickCore/profile.c

index dedaa8c446051e1f5ec7eb3dc767777e78a12284..5719d6313dfe54573e8e649b79caf9d06d907a40 100644 (file)
@@ -1525,25 +1525,31 @@ MagickBooleanType SyncExifProfile(Image *image,StringInfo *profile)
   */
   length=GetStringInfoLength(profile);
   exif=GetStringInfoDatum(profile);
-  while (length != 0)
-  {
-    if (ReadProfileByte(&exif,&length) != 0x45)
-      continue;
-    if (ReadProfileByte(&exif,&length) != 0x78)
-      continue;
-    if (ReadProfileByte(&exif,&length) != 0x69)
-      continue;
-    if (ReadProfileByte(&exif,&length) != 0x66)
-      continue;
-    if (ReadProfileByte(&exif,&length) != 0x00)
-      continue;
-    if (ReadProfileByte(&exif,&length) != 0x00)
-      continue;
-    break;
-  }
   if (length < 16)
     return(MagickFalse);
   id=(ssize_t) ReadProfileShort(LSBEndian,exif);
+  if ((id != 0x4949) && (id != 0x4D4D))
+    {
+      while (length != 0)
+      {
+        if (ReadProfileByte(&exif,&length) != 0x45)
+          continue;
+        if (ReadProfileByte(&exif,&length) != 0x78)
+          continue;
+        if (ReadProfileByte(&exif,&length) != 0x69)
+          continue;
+        if (ReadProfileByte(&exif,&length) != 0x66)
+          continue;
+        if (ReadProfileByte(&exif,&length) != 0x00)
+          continue;
+        if (ReadProfileByte(&exif,&length) != 0x00)
+          continue;
+        break;
+      }
+      if (length < 16)
+        return(MagickFalse);
+      id=(ssize_t) ReadProfileShort(LSBEndian,exif);
+    }
   endian=LSBEndian;
   if (id == 0x4949)
     endian=LSBEndian;