File ImageMagick-CVE-2026-25983.patch of Package ImageMagick.42999
From b4f8e1a387dd1d0a0af516071831a235f2fdf437 Mon Sep 17 00:00:00 2001
From: Dirk Lemstra <dirk@lemstra.org>
Date: Sun, 25 Jan 2026 18:49:10 +0100
Subject: [PATCH] No longer allow mutations on the first image of the list
(GHSA-fwqw-2x5x-w566)
---
coders/msl.c | 150 +++++++++++++++++++++++++--------------------------
1 file changed, 75 insertions(+), 75 deletions(-)
Index: ImageMagick-6.8.8-1/coders/msl.c
===================================================================
--- ImageMagick-6.8.8-1.orig/coders/msl.c
+++ ImageMagick-6.8.8-1/coders/msl.c
@@ -695,7 +695,7 @@ static void MSLStartElement(void *contex
/*
Add noise image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || ((n < 1) || (msl_info->image[n] == (Image *) NULL)))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -769,7 +769,7 @@ static void MSLStartElement(void *contex
/*
Annotate image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -1105,7 +1105,7 @@ static void MSLStartElement(void *contex
MagickBooleanType
stack;
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -1169,7 +1169,7 @@ static void MSLStartElement(void *contex
/*
Blur image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -1264,7 +1264,7 @@ static void MSLStartElement(void *contex
/*
Border image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -1385,7 +1385,7 @@ static void MSLStartElement(void *contex
/*
Add noise image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -1449,7 +1449,7 @@ static void MSLStartElement(void *contex
double radius = 0.0,
sigma = 1.0;
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -1524,7 +1524,7 @@ static void MSLStartElement(void *contex
/*
Chop image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -1631,7 +1631,7 @@ static void MSLStartElement(void *contex
/*
Color floodfill image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -1762,7 +1762,7 @@ static void MSLStartElement(void *contex
/*
Composite image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -2104,7 +2104,7 @@ static void MSLStartElement(void *contex
/*
Contrast image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -2157,7 +2157,7 @@ static void MSLStartElement(void *contex
/*
Crop image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -2259,7 +2259,7 @@ static void MSLStartElement(void *contex
/*
Cycle-colormap image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -2312,7 +2312,7 @@ static void MSLStartElement(void *contex
/*
Despeckle image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -2338,7 +2338,7 @@ static void MSLStartElement(void *contex
}
if (LocaleCompare((const char *) tag,"display") == 0)
{
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -2373,7 +2373,7 @@ static void MSLStartElement(void *contex
/*
Annotate image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -2733,7 +2733,7 @@ static void MSLStartElement(void *contex
/*
Edge image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -2800,7 +2800,7 @@ static void MSLStartElement(void *contex
/*
Emboss image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -2879,7 +2879,7 @@ static void MSLStartElement(void *contex
/*
Enhance image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -2908,7 +2908,7 @@ static void MSLStartElement(void *contex
/*
Equalize image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -2942,7 +2942,7 @@ static void MSLStartElement(void *contex
{
if (LocaleCompare((const char *) tag, "flatten") == 0)
{
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -2973,7 +2973,7 @@ static void MSLStartElement(void *contex
/*
Flip image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -3005,7 +3005,7 @@ static void MSLStartElement(void *contex
/*
Flop image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -3040,7 +3040,7 @@ static void MSLStartElement(void *contex
/*
Frame image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -3190,7 +3190,7 @@ static void MSLStartElement(void *contex
/*
Gamma image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -3308,7 +3308,7 @@ static void MSLStartElement(void *contex
}
else if (LocaleCompare((const char *) tag,"get") == 0)
{
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || msl_info->image[n] == (Image *) NULL)
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -3437,7 +3437,7 @@ static void MSLStartElement(void *contex
/*
Implode image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -3508,7 +3508,7 @@ static void MSLStartElement(void *contex
double
levelBlack = 0, levelGamma = 1, levelWhite = QuantumRange;
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -3585,7 +3585,7 @@ static void MSLStartElement(void *contex
/*
Magnify image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -3623,7 +3623,7 @@ static void MSLStartElement(void *contex
/*
Map image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -3712,7 +3712,7 @@ static void MSLStartElement(void *contex
Matte floodfill image.
*/
opacity=0.0;
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -3838,7 +3838,7 @@ static void MSLStartElement(void *contex
/*
Median-filter image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -3906,7 +3906,7 @@ static void MSLStartElement(void *contex
/*
Minify image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -3940,7 +3940,7 @@ static void MSLStartElement(void *contex
/*
Modulate image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -4068,7 +4068,7 @@ static void MSLStartElement(void *contex
/*
Negate image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -4134,7 +4134,7 @@ static void MSLStartElement(void *contex
/*
Normalize image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -4190,7 +4190,7 @@ static void MSLStartElement(void *contex
/*
Oil-paint image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -4258,7 +4258,7 @@ static void MSLStartElement(void *contex
/*
Opaque image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -4362,7 +4362,7 @@ static void MSLStartElement(void *contex
}
if (LocaleCompare((const char *) tag, "profile") == 0)
{
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -4475,7 +4475,7 @@ static void MSLStartElement(void *contex
/*
Quantize image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -4952,7 +4952,7 @@ static void MSLStartElement(void *contex
/*
Raise image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -5089,7 +5089,7 @@ static void MSLStartElement(void *contex
/*
Reduce-noise image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -5151,18 +5151,17 @@ static void MSLStartElement(void *contex
}
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 (msl_info->image[n] == (Image *) NULL)
+ 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++)
@@ -5284,7 +5283,7 @@ static void MSLStartElement(void *contex
x_resolution,
y_resolution;
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -5404,7 +5403,7 @@ static void MSLStartElement(void *contex
/*
Resize image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -5512,7 +5511,7 @@ static void MSLStartElement(void *contex
/*
Roll image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -5586,19 +5585,18 @@ static void MSLStartElement(void *contex
}
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 (msl_info->image[n] == (Image *) NULL)
+ 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++];
@@ -5673,7 +5671,7 @@ static void MSLStartElement(void *contex
/*
Rotate image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -5737,7 +5735,7 @@ static void MSLStartElement(void *contex
/* init the values */
double degrees = 0;
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -5802,7 +5800,7 @@ static void MSLStartElement(void *contex
/*
Sample image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -5879,7 +5877,7 @@ static void MSLStartElement(void *contex
/*
Scale image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -5959,7 +5957,7 @@ static void MSLStartElement(void *contex
/*
Segment image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -6043,7 +6041,7 @@ static void MSLStartElement(void *contex
}
else if (LocaleCompare((const char *) tag, "set") == 0)
{
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",(const char *) tag);
break;
@@ -6210,7 +6208,7 @@ static void MSLStartElement(void *contex
/*
Shade image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -6301,7 +6299,7 @@ static void MSLStartElement(void *contex
/*
Shear image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -6400,7 +6398,7 @@ static void MSLStartElement(void *contex
double radius = 0.0,
sigma = 1.0;
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -6472,7 +6470,7 @@ static void MSLStartElement(void *contex
width = height = 0;
x = y = 0;
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -6563,7 +6561,7 @@ static void MSLStartElement(void *contex
/*
Shear image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -6652,7 +6650,7 @@ static void MSLStartElement(void *contex
/*
Signature image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -6684,7 +6682,7 @@ static void MSLStartElement(void *contex
/*
Solarize image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -6745,7 +6743,7 @@ static void MSLStartElement(void *contex
/*
Spread image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -6809,7 +6807,7 @@ static void MSLStartElement(void *contex
Image *
watermark = (Image*)NULL;
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -6876,7 +6874,7 @@ static void MSLStartElement(void *contex
Image *
stereoImage = (Image*)NULL;
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",(const char *) tag);
break;
@@ -6942,7 +6940,7 @@ static void MSLStartElement(void *contex
/*
Strip image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -6972,7 +6970,7 @@ static void MSLStartElement(void *contex
index,
swap_index;
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -7037,7 +7035,7 @@ static void MSLStartElement(void *contex
/*
Swirl image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -7101,7 +7099,7 @@ static void MSLStartElement(void *contex
/*
Sync image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -7141,7 +7139,7 @@ static void MSLStartElement(void *contex
/*
Texture image.
*/
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -7195,7 +7193,7 @@ static void MSLStartElement(void *contex
/* init the values */
double threshold = 0;
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",(const char *) tag);
break;
@@ -7242,7 +7240,7 @@ static void MSLStartElement(void *contex
}
else if (LocaleCompare((const char *) tag, "transparent") == 0)
{
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",(const char *) tag);
break;
@@ -7285,7 +7283,7 @@ static void MSLStartElement(void *contex
}
else if (LocaleCompare((const char *) tag, "trim") == 0)
{
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",(const char *) tag);
break;
@@ -7319,7 +7317,7 @@ static void MSLStartElement(void *contex
{
if (LocaleCompare((const char *) tag,"write") == 0)
{
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -7407,7 +7405,7 @@ static void MSLEndElement(void *context,
{
if (LocaleCompare((const char *) tag,"comment") == 0 )
{
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);
@@ -7457,7 +7455,7 @@ static void MSLEndElement(void *context,
{
if (LocaleCompare((const char *) tag,"label") == 0 )
{
- if (msl_info->image[n] == (Image *) NULL)
+ if ((n < 1) || (msl_info->image[n] == (Image *) NULL))
{
ThrowMSLException(OptionError,"NoImagesDefined",
(const char *) tag);