File ImageMagick-CVE-2026-25983.patch of Package ImageMagick.42998
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-7.1.0-9/coders/msl.c
===================================================================
--- ImageMagick-7.1.0-9.orig/coders/msl.c
+++ ImageMagick-7.1.0-9/coders/msl.c
@@ -694,7 +694,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);
@@ -770,7 +770,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);
@@ -1265,7 +1265,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);
@@ -1386,7 +1386,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);
@@ -1451,7 +1451,7 @@ static void MSLStartElement(void *contex
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);
@@ -1526,7 +1526,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);
@@ -1633,7 +1633,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);
@@ -1765,7 +1765,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);
@@ -2108,7 +2108,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);
@@ -2162,7 +2162,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);
@@ -2264,7 +2264,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);
@@ -2317,7 +2317,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);
@@ -2343,7 +2343,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);
@@ -2379,7 +2379,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);
@@ -2741,7 +2741,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);
@@ -2807,7 +2807,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);
@@ -2886,7 +2886,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);
@@ -2915,7 +2915,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);
@@ -2950,7 +2950,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);
@@ -2981,7 +2981,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);
@@ -3013,7 +3013,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);
@@ -3048,7 +3048,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);
@@ -3199,7 +3199,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);
@@ -3294,7 +3294,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);
@@ -3425,7 +3425,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);
@@ -3496,7 +3496,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);
@@ -3569,7 +3569,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);
@@ -3607,7 +3607,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);
@@ -3698,7 +3698,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);
@@ -3830,7 +3830,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);
@@ -3898,7 +3898,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);
@@ -3932,7 +3932,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);
@@ -4061,7 +4061,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);
@@ -4130,7 +4130,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);
@@ -4187,7 +4187,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);
@@ -4255,7 +4255,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);
@@ -4364,7 +4364,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);
@@ -4477,7 +4477,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);
@@ -4955,7 +4955,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);
@@ -5093,7 +5093,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);
@@ -5155,18 +5155,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++)
@@ -5285,7 +5284,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);
@@ -5387,7 +5386,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);
@@ -5482,7 +5481,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);
@@ -5556,19 +5555,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++];
@@ -5643,7 +5641,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);
@@ -5707,7 +5705,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);
@@ -5772,7 +5770,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);
@@ -5849,7 +5847,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);
@@ -5929,7 +5927,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);
@@ -6013,7 +6011,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;
@@ -6187,7 +6185,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);
@@ -6278,7 +6276,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);
@@ -6378,7 +6376,7 @@ static void MSLStartElement(void *contex
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);
@@ -6451,7 +6449,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);
@@ -6542,7 +6540,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);
@@ -6631,7 +6629,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);
@@ -6663,7 +6661,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);
@@ -6725,7 +6723,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);
@@ -6790,7 +6788,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);
@@ -6858,7 +6856,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;
@@ -6925,7 +6923,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);
@@ -6955,7 +6953,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);
@@ -7021,7 +7019,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);
@@ -7085,7 +7083,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);
@@ -7125,7 +7123,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);
@@ -7180,7 +7178,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;
@@ -7225,7 +7223,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;
@@ -7269,7 +7267,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;
@@ -7303,7 +7301,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);
@@ -7393,7 +7391,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);
@@ -7446,7 +7444,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);