Commit 257200cb2 for imagemagick.org

commit 257200cb21de23404dce5f8261871845d425dee5
Author: Dirk Lemstra <dirk@lemstra.org>
Date:   Mon Jan 26 21:08:30 2026 +0100

    Run checks before accessing the image (GHSA-fwqw-2x5x-w566).

diff --git a/coders/msl.c b/coders/msl.c
index ccc1b0828..76645b3e7 100644
--- a/coders/msl.c
+++ b/coders/msl.c
@@ -4865,18 +4865,17 @@ static void MSLStartElement(void *context,const xmlChar *tag,
         }
       else if (LocaleCompare((const char *) tag,"repage") == 0)
       {
-        /* init the values */
-        width=msl_info->image[n]->page.width;
-        height=msl_info->image[n]->page.height;
-        x=msl_info->image[n]->page.x;
-        y=msl_info->image[n]->page.y;
-
         if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
         {
           ThrowMSLException(OptionError,"NoImagesDefined",
             (const char *) tag);
           break;
         }
+        /* init the values */
+        width=msl_info->image[n]->page.width;
+        height=msl_info->image[n]->page.height;
+        x=msl_info->image[n]->page.x;
+        y=msl_info->image[n]->page.y;
         if (attributes == (const xmlChar **) NULL)
           break;
         for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
@@ -5268,19 +5267,18 @@ static void MSLStartElement(void *context,const xmlChar *tag,
         }
       else if (LocaleCompare((const char *) tag,"roll") == 0)
       {
-        /* init the values */
-        width=msl_info->image[n]->columns;
-        height=msl_info->image[n]->rows;
-        x = y = 0;
-
         if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
         {
           ThrowMSLException(OptionError,"NoImagesDefined",
             (const char *) tag);
           break;
         }
+        /* init the values */
+        width=msl_info->image[n]->columns;
+        height=msl_info->image[n]->rows;
+        x = y = 0;
         if (attributes == (const xmlChar **) NULL)
-        break;
+          break;
         for (i=0; (attributes[i] != (const xmlChar *) NULL); i++)
         {
           keyword=(const char *) attributes[i++];