Commit 083a4b4e3 for imagemagick.org

commit 083a4b4e36741f4aca19a6fc206538ecce1f774e
Author: Cristy <urban-warrior@imagemagick.org>
Date:   Sat Aug 15 09:30:54 2026 -0400

    earlier check for authorized path

diff --git a/MagickCore/delegate.c b/MagickCore/delegate.c
index 75d38cae4..4d4c246cf 100644
--- a/MagickCore/delegate.c
+++ b/MagickCore/delegate.c
@@ -1665,6 +1665,8 @@ static MagickBooleanType CopyDelegateFile(const char *source,
     O_NOFOLLOW,S_MODE);
   if (destination_file == -1)
     return(MagickFalse);
+  if (IsPathAuthorized(WritePolicyRights,destination) == MagickFalse)
+    ThrowPolicyException(destination,MagickFalse);
   if (IsPathAuthorized(ReadPolicyRights,source) == MagickFalse)
     {
       (void) close_utf8(destination_file);
@@ -1700,8 +1702,6 @@ static MagickBooleanType CopyDelegateFile(const char *source,
   (void) close_utf8(destination_file);
   (void) close_utf8(source_file);
   buffer=(unsigned char *) RelinquishMagickMemory(buffer);
-  if (IsPathAuthorized(WritePolicyRights,destination) == MagickFalse)
-    ThrowPolicyException(destination,MagickFalse);
   return(status);
 }