]> granicus.if.org Git - imagemagick/commitdiff
Check image magick against delegates
authorCristy <urban-warrior@imagemagick.org>
Mon, 6 Jun 2016 13:18:22 +0000 (09:18 -0400)
committerCristy <urban-warrior@imagemagick.org>
Mon, 6 Jun 2016 13:18:22 +0000 (09:18 -0400)
MagickCore/constitute.c
MagickCore/image.c

index 7723e1590850095de5f51a2ce1338e8b48699b58..79a5a8030cd58f33c4f83a52bf1aa4cba8559047 100644 (file)
@@ -1017,7 +1017,7 @@ MagickExport MagickBooleanType WriteImage(const ImageInfo *image_info,
       ThrowBinaryException(PolicyError,"NotAuthorized",filename);
     }
   /*
-    Call appropriate image reader based on image type.
+    Call appropriate image writer based on image type.
   */
   magick_info=GetMagickInfo(write_info->magick,sans_exception);
   sans_exception=DestroyExceptionInfo(sans_exception);
index c9c718d0d03e640ec5c6cc39713e6df4f18bb6b2..49c34c8d3a3dcc87b9398c02abbdae52d274f51c 100644 (file)
@@ -59,6 +59,7 @@
 #include "MagickCore/composite-private.h"
 #include "MagickCore/compress.h"
 #include "MagickCore/constitute.h"
+#include "MagickCore/delegate.h"
 #include "MagickCore/display.h"
 #include "MagickCore/draw.h"
 #include "MagickCore/enhance.h"
@@ -2679,16 +2680,23 @@ MagickExport MagickBooleanType SetImageInfo(ImageInfo *image_info,
     }
   else
     {
+      const DelegateInfo
+        *delegate_info;
+
       /*
         User specified image format.
       */
       LocaleUpper(magic);
       magick_info=GetMagickInfo(magic,sans_exception);
-      if ((magick_info != (const MagickInfo *) NULL) &&
+      delegate_info=GetDelegateInfo(magic,(const char *) NULL,sans_exception);
+      if (delegate_info == (const DelegateInfo *) NULL)
+        delegate_info=GetDelegateInfo((const char *) NULL,magic,sans_exception);
+      if (((magick_info != (const MagickInfo *) NULL) ||
+           (delegate_info != (const DelegateInfo *) NULL)) &&
           (IsMagickConflict(magic) == MagickFalse))
         {
-          (void) CopyMagickString(image_info->magick,magic,MagickPathExtent);
           image_info->affirm=MagickTrue;
+          (void) CopyMagickString(image_info->magick,magic,MagickPathExtent);
           GetPathComponent(image_info->filename,CanonicalPath,component);
           (void) CopyMagickString(image_info->filename,component,
             MagickPathExtent);