Commit fb8842ff7 for imagemagick.org

commit fb8842ff7ab351cd85a253c780fbfcf1199d7e4c
Author: Cristy <urban-warrior@imagemagick.org>
Date:   Mon Sep 28 19:49:26 2026 -0400

    https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-pj4h-g4pf-66v3

diff --git a/PerlMagick/Magick.xs b/PerlMagick/Magick.xs
index a42be249a..c75e3545a 100644
--- a/PerlMagick/Magick.xs
+++ b/PerlMagick/Magick.xs
@@ -1362,11 +1362,13 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
       if (LocaleCompare(attribute,"comment") == 0)
         {
           for ( ; image; image=image->next)
-            {
-              char *property = InterpretImageProperties(info ? info->image_info : (ImageInfo *) NULL,image,SvPV(sval,na),exception);
-              (void) SetImageProperty(image,"Comment",property,exception);
-              if (property != (char *) NULL) property=(char *) RelinquishMagickMemory(property);
-            }
+          {
+            char *property = InterpretImageProperties(info ? info->image_info :
+              (ImageInfo *) NULL,image,SvPV(sval,na),exception);
+            (void) SetImageProperty(image,"comment",property,exception);
+            if (property != (char *) NULL)
+              property=(char *) RelinquishMagickMemory(property);
+          }
           break;
         }
       if (LocaleCompare(attribute,"compression") == 0)
@@ -1732,11 +1734,13 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
       if (LocaleCompare(attribute,"label") == 0)
         {
           for ( ; image; image=image->next)
-            {
-              char *property = InterpretImageProperties(info ? info->image_info : (ImageInfo *) NULL,image,SvPV(sval,na),exception);
-              (void) SetImageProperty(image,"label",property,exception);
-              if (property != (char *) NULL) property=(char *) RelinquishMagickMemory(property);
-            }
+          {
+            char *property = InterpretImageProperties(info ? info->image_info :
+              (ImageInfo *) NULL,image,SvPV(sval,na),exception);
+            (void) SetImageProperty(image,"label",property,exception);
+            if (property != (char *) NULL)
+              property=(char *) RelinquishMagickMemory(property);
+          }
           break;
         }
       if (LocaleCompare(attribute,"loop") == 0)
@@ -7997,20 +8001,32 @@ Mogrify(ref,...)
         }
         case 1:  /* Comment */
         {
+          char
+            *property;
+
           if (attribute_flag[0] == 0)
             argument_list[0].string_reference=(char *) NULL;
-          char *property = InterpretImageProperties(info ? info->image_info : (ImageInfo *) NULL,image,argument_list[0].string_reference,exception);
+          property=InterpretImageProperties(info ? info->image_info :
+            (ImageInfo *) NULL,image,argument_list[0].string_reference,
+            exception);
           (void) SetImageProperty(image,"comment",property,exception);
-          if (property != (char *) NULL) property=(char *) RelinquishMagickMemory(property);
+          if (property != (char *) NULL)
+            property=(char *) RelinquishMagickMemory(property);
           break;
         }
         case 2:  /* Label */
         {
+          char
+            *property;
+
           if (attribute_flag[0] == 0)
             argument_list[0].string_reference=(char *) NULL;
-          char *property = InterpretImageProperties(info ? info->image_info : (ImageInfo *) NULL,image,argument_list[0].string_reference,exception);
+          property=InterpretImageProperties(info ? info->image_info :
+            (ImageInfo *) NULL,image,argument_list[0].string_reference,
+            exception);
           (void) SetImageProperty(image,"label",property,exception);
-          if (property != (char *) NULL) property=(char *) RelinquishMagickMemory(property);
+          if (property != (char *) NULL)
+            property=(char *) RelinquishMagickMemory(property);
           break;
         }
         case 3:  /* AddNoise */
@@ -11922,11 +11938,14 @@ Montage(ref,...)
           if (LocaleCompare(attribute,"label") == 0)
             {
               for (next=image; next; next=next->next)
-                {
-                  char *property = InterpretImageProperties(info ? info->image_info : (ImageInfo *) NULL,next,SvPV(ST(i),na),exception);
-                  (void) SetImageProperty(next,"label",property,exception);
-                  if (property != (char *) NULL) property=(char *) RelinquishMagickMemory(property);
-                }
+              {
+                char *property = InterpretImageProperties(info ?
+                  info->image_info : (ImageInfo *) NULL,next,SvPV(ST(i),na),
+                  exception);
+                (void) SetImageProperty(next,"label",property,exception);
+                if (property != (char *) NULL)
+                  property=(char *) RelinquishMagickMemory(property);
+              }
               break;
             }
           ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",
diff --git a/PerlMagick/quantum/quantum.xs.in b/PerlMagick/quantum/quantum.xs.in
index b1b3ad1b4..4798cc314 100644
--- a/PerlMagick/quantum/quantum.xs.in
+++ b/PerlMagick/quantum/quantum.xs.in
@@ -1362,9 +1362,13 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
       if (LocaleCompare(attribute,"comment") == 0)
         {
           for ( ; image; image=image->next)
-            (void) SetImageProperty(image,"Comment",InterpretImageProperties(
-              info ? info->image_info : (ImageInfo *) NULL,image,
-              SvPV(sval,na),exception),exception);
+          {
+            char *property = InterpretImageProperties(info ? info->image_info :
+              (ImageInfo *) NULL,image,SvPV(sval,na),exception);
+            (void) SetImageProperty(image,"comment",property,exception);
+            if (property != (char *) NULL)
+              property=(char *) RelinquishMagickMemory(property);
+          }
           break;
         }
       if (LocaleCompare(attribute,"compression") == 0)
@@ -1727,11 +1731,13 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image,
       if (LocaleCompare(attribute,"label") == 0)
         {
           for ( ; image; image=image->next)
-            {
-              char *property = InterpretImageProperties(info ? info->image_info : (ImageInfo *) NULL,image,SvPV(sval,na),exception);
-              (void) SetImageProperty(image,"label",property,exception);
-              if (property != (char *) NULL) property=(char *) RelinquishMagickMemory(property);
-            }
+          {
+            char *property = InterpretImageProperties(info ? info->image_info :
+              (ImageInfo *) NULL,image,SvPV(sval,na),exception);
+            (void) SetImageProperty(image,"label",property,exception);
+            if (property != (char *) NULL)
+              property=(char *) RelinquishMagickMemory(property);
+          }
           break;
         }
       if (LocaleCompare(attribute,"loop") == 0)
@@ -8017,10 +8023,13 @@ Mogrify(ref,...)
           if (attribute_flag[0] == 0)
             argument_list[0].string_reference=(char *) NULL;
           {
-          char *property = InterpretImageProperties(info ? info->image_info : (ImageInfo *) NULL,image,argument_list[0].string_reference,exception);
-          (void) SetImageProperty(image,"comment",property,exception);
-          if (property != (char *) NULL) property=(char *) RelinquishMagickMemory(property);
-        }
+            char *property = InterpretImageProperties(info ? info->image_info :
+              (ImageInfo *) NULL,image,argument_list[0].string_reference,
+              exception);
+            (void) SetImageProperty(image,"comment",property,exception);
+            if (property != (char *) NULL)
+              property=(char *) RelinquishMagickMemory(property);
+          }
           break;
         }
         case 2:  /* Label */
@@ -8028,10 +8037,13 @@ Mogrify(ref,...)
           if (attribute_flag[0] == 0)
             argument_list[0].string_reference=(char *) NULL;
           {
-          char *property = InterpretImageProperties(info ? info->image_info : (ImageInfo *) NULL,image,argument_list[0].string_reference,exception);
-          (void) SetImageProperty(image,"label",property,exception);
-          if (property != (char *) NULL) property=(char *) RelinquishMagickMemory(property);
-        }
+            char *property = InterpretImageProperties(info ? info->image_info :
+              (ImageInfo *) NULL,image,argument_list[0].string_reference,
+              exception);
+            (void) SetImageProperty(image,"label",property,exception);
+            if (property != (char *) NULL)
+              property=(char *) RelinquishMagickMemory(property);
+          }
           break;
         }
         case 3:  /* AddNoise */
@@ -11947,11 +11959,14 @@ Montage(ref,...)
           if (LocaleCompare(attribute,"label") == 0)
             {
               for (next=image; next; next=next->next)
-                {
-                  char *property = InterpretImageProperties(info ? info->image_info : (ImageInfo *) NULL,next,SvPV(ST(i),na),exception);
-                  (void) SetImageProperty(next,"label",property,exception);
-                  if (property != (char *) NULL) property=(char *) RelinquishMagickMemory(property);
-                }
+              {
+                char *property = InterpretImageProperties(info ?
+                  info->image_info : (ImageInfo *) NULL,next,SvPV(ST(i),na),
+                  exception);
+                (void) SetImageProperty(next,"label",property,exception);
+                if (property != (char *) NULL)
+                  property=(char *) RelinquishMagickMemory(property);
+              }
               break;
             }
           ThrowPerlException(exception,OptionError,"UnrecognizedAttribute",