]> granicus.if.org Git - imagemagick/commitdiff
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6462
authorCristy <urban-warrior@imagemagick.org>
Mon, 19 Feb 2018 23:55:11 +0000 (18:55 -0500)
committerCristy <urban-warrior@imagemagick.org>
Mon, 19 Feb 2018 23:55:11 +0000 (18:55 -0500)
coders/gif.c

index a067a717a66d19deb5b504b5bdca22ad79de3f28..70d319e32b324e702bec57e687efae7c1c8c76ee 100644 (file)
@@ -1261,25 +1261,6 @@ static Image *ReadGIFImage(const ImageInfo *image_info,ExceptionInfo *exception)
     meta_image->scene=image->scene;
     (void) CloneImageProperties(image,meta_image);
     DestroyImageProperties(meta_image);
-    if (profiles != (LinkedListInfo *) NULL)
-      {
-        StringInfo
-          *profile;
-
-        /*
-          Set image profiles.
-        */
-        ResetLinkedListIterator(profiles);
-        profile=(StringInfo *) GetNextValueInLinkedList(profiles);
-        while (profile != (StringInfo *) NULL)
-        {
-          (void) SetImageProfile(image,GetStringInfoName(profile),profile,
-            exception);
-          profile=(StringInfo *) GetNextValueInLinkedList(profiles);
-        }
-      }
-    if (profiles != (LinkedListInfo *) NULL)
-      profiles=DestroyLinkedList(profiles,DestroyGIFProfile);
     image->storage_class=PseudoClass;
     image->compression=LZWCompression;
     image->columns=ReadBlobLSBShort(image);
@@ -1382,6 +1363,24 @@ static Image *ReadGIFImage(const ImageInfo *image_info,ExceptionInfo *exception)
       status=DecodeImage(image,opacity,exception);
     if ((image_info->ping == MagickFalse) && (status == MagickFalse))
       ThrowGIFException(CorruptImageError,"CorruptImage");
+    if (profiles != (LinkedListInfo *) NULL)
+      {
+        StringInfo
+          *profile;
+
+        /*
+          Set image profiles.
+        */
+        ResetLinkedListIterator(profiles);
+        profile=(StringInfo *) GetNextValueInLinkedList(profiles);
+        while (profile != (StringInfo *) NULL)
+        {
+          (void) SetImageProfile(image,GetStringInfoName(profile),profile,
+            exception);
+          profile=(StringInfo *) GetNextValueInLinkedList(profiles);
+        }
+        profiles=DestroyLinkedList(profiles,DestroyGIFProfile);
+      }
     duration+=image->delay*image->iterations;
     if (image_info->number_scenes != 0)
       if (image->scene >= (image_info->scene+image_info->number_scenes-1))