diff --git a/coders/aai.c b/coders/aai.c
index dc9468e..bc31f6f 100644
--- a/coders/aai.c
+++ b/coders/aai.c
@@ -159,6 +159,9 @@
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
pixels=(unsigned char *) AcquireQuantumMemory(image->columns,
4*sizeof(*pixels));
if (pixels == (unsigned char *) NULL)
diff --git a/coders/art.c b/coders/art.c
index a9392b7..bc9d7c1 100644
--- a/coders/art.c
+++ b/coders/art.c
@@ -146,6 +146,9 @@
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Convert bi-level image to pixel packets.
*/
diff --git a/coders/avs.c b/coders/avs.c
index fffb682..4e28d5f 100644
--- a/coders/avs.c
+++ b/coders/avs.c
@@ -159,6 +159,9 @@
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
pixels=(unsigned char *) AcquireQuantumMemory(image->columns,
4*sizeof(*pixels));
if (pixels == (unsigned char *) NULL)
diff --git a/coders/bgr.c b/coders/bgr.c
index 2a70fb0..8dceca3 100644
--- a/coders/bgr.c
+++ b/coders/bgr.c
@@ -197,6 +197,9 @@
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
switch (image_info->interlace)
{
case NoInterlace:
diff --git a/coders/bmp.c b/coders/bmp.c
index ec3481d..e5899df 100644
--- a/coders/bmp.c
+++ b/coders/bmp.c
@@ -920,6 +920,9 @@
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Read image data.
*/
diff --git a/coders/cin.c b/coders/cin.c
index d02201c..81c9b8f 100644
--- a/coders/cin.c
+++ b/coders/cin.c
@@ -717,11 +717,14 @@
image->depth=cin.image.channel[0].bits_per_pixel;
image->columns=cin.image.channel[0].pixels_per_line;
image->rows=cin.image.channel[0].lines_per_image;
- if (image_info->ping)
+ if (image_info->ping != MagickFalse)
{
(void) CloseBlob(image);
return(image);
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Convert CIN raster image to pixel packets.
*/
diff --git a/coders/clipboard.c b/coders/clipboard.c
index f473d51..8ebd5ac 100644
--- a/coders/clipboard.c
+++ b/coders/clipboard.c
@@ -163,9 +163,12 @@
GetObject(bitmapH,sizeof(BITMAP),(LPSTR) &bitmap);
if ((image->columns == 0) || (image->rows == 0))
{
- image->rows=bitmap.bmHeight;
image->columns=bitmap.bmWidth;
+ image->rows=bitmap.bmHeight;
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Initialize the bitmap header info.
*/
diff --git a/coders/cmyk.c b/coders/cmyk.c
index b47ac1d..2a5335b 100644
--- a/coders/cmyk.c
+++ b/coders/cmyk.c
@@ -197,6 +197,9 @@
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
SetImageColorspace(image,CMYKColorspace,exception);
switch (image_info->interlace)
{
diff --git a/coders/cut.c b/coders/cut.c
index 855b3a9..3b1f6df 100644
--- a/coders/cut.c
+++ b/coders/cut.c
@@ -373,7 +373,10 @@
image->depth=8;
image->colors=(size_t) (GetQuantumRange(1UL*i)+1);
- if (image_info->ping) goto Finish;
+ if (image_info->ping != MagickFalse) goto Finish;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/* ----- Do something with palette ----- */
if ((clone_info=CloneImageInfo(image_info)) == NULL) goto NoPalette;
diff --git a/coders/dcm.c b/coders/dcm.c
index 7a1f159..12a4c2e 100644
--- a/coders/dcm.c
+++ b/coders/dcm.c
@@ -3687,6 +3687,9 @@
image->columns=(size_t) width;
image->rows=(size_t) height;
image->depth=depth;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ break;
image->colorspace=RGBColorspace;
if ((image->colormap == (PixelInfo *) NULL) && (samples_per_pixel == 1))
{
diff --git a/coders/dds.c b/coders/dds.c
index 91e416a..c621977 100644
--- a/coders/dds.c
+++ b/coders/dds.c
@@ -1839,7 +1839,9 @@
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
-
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
if ((decoder)(image, &dds_info, exception) != MagickTrue)
{
(void) CloseBlob(image);
diff --git a/coders/dib.c b/coders/dib.c
index b3e6388..3fe828a 100644
--- a/coders/dib.c
+++ b/coders/dib.c
@@ -516,7 +516,7 @@
*/
(void) ResetMagickMemory(&dib_info,0,sizeof(dib_info));
dib_info.size=ReadBlobLSBLong(image);
- if (dib_info.size!=40)
+ if (dib_info.size != 40)
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
/*
Microsoft Windows 3.X DIB image file.
@@ -570,6 +570,9 @@
if ((geometry.height != 0) && (geometry.height < image->rows))
image->rows=geometry.height;
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
if (image->storage_class == PseudoClass)
{
size_t
diff --git a/coders/djvu.c b/coders/djvu.c
index ae0b7e4..cb61c77 100644
--- a/coders/djvu.c
+++ b/coders/djvu.c
@@ -575,6 +575,7 @@
Image *image;
int logging;
int tag;
+ MagickBooleanType status;
/* so, we know that the page is there! Get its dimension, and */
@@ -665,6 +666,9 @@
image->alpha_trait = BlendPixelTrait;
/* is this useful? */
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
#if DEBUG
printf("now filling %.20g x %.20g\n",(double) image->columns,(double)
image->rows);
diff --git a/coders/dps.c b/coders/dps.c
index f9e8bd8..0b26f7f 100644
--- a/coders/dps.c
+++ b/coders/dps.c
@@ -325,6 +325,9 @@
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
switch (image->storage_class)
{
case DirectClass:
diff --git a/coders/dpx.c b/coders/dpx.c
index c86a375..6ad812b 100644
--- a/coders/dpx.c
+++ b/coders/dpx.c
@@ -1117,6 +1117,9 @@
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
for (n=0; n < (ssize_t) dpx.image.number_elements; n++)
{
/*
diff --git a/coders/emf.c b/coders/emf.c
index 72f2e7a..74703dc 100644
--- a/coders/emf.c
+++ b/coders/emf.c
@@ -507,6 +507,9 @@
y=0;
(void) GetGeometry(image_info->size,&x,&y,&image->columns,&image->rows);
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
if (image_info->page != (char *) NULL)
{
char
diff --git a/coders/exr.c b/coders/exr.c
index dca5fb9..0a07336 100644
--- a/coders/exr.c
+++ b/coders/exr.c
@@ -213,6 +213,9 @@
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
scanline=(ImfRgba *) AcquireQuantumMemory(image->columns,sizeof(*scanline));
if (scanline == (ImfRgba *) NULL)
{
diff --git a/coders/fax.c b/coders/fax.c
index ee9d6f0..f09c985 100644
--- a/coders/fax.c
+++ b/coders/fax.c
@@ -178,6 +178,9 @@
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
status=HuffmanDecodeImage(image,exception);
if (status == MagickFalse)
ThrowReaderException(CorruptImageError,"UnableToReadImageData");
diff --git a/coders/fits.c b/coders/fits.c
index e3b7048..1a2529b 100644
--- a/coders/fits.c
+++ b/coders/fits.c
@@ -423,6 +423,9 @@
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Initialize image structure.
*/
diff --git a/coders/fpx.c b/coders/fpx.c
index e2beabe..489c3e9 100644
--- a/coders/fpx.c
+++ b/coders/fpx.c
@@ -350,6 +350,9 @@
FPX_ClearSystem();
return(GetFirstImageInList(image));
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Allocate memory for the image and pixel buffer.
*/
diff --git a/coders/gif.c b/coders/gif.c
index 17029f1..ab26ea9 100644
--- a/coders/gif.c
+++ b/coders/gif.c
@@ -1346,6 +1346,9 @@
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Decode image.
*/
diff --git a/coders/gray.c b/coders/gray.c
index 64e4de0..703cf6d 100644
--- a/coders/gray.c
+++ b/coders/gray.c
@@ -187,6 +187,9 @@
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
SetImageColorspace(image,GRAYColorspace,exception);
if (scene == 0)
{
diff --git a/coders/hald.c b/coders/hald.c
index f9794a7..ec63522 100644
--- a/coders/hald.c
+++ b/coders/hald.c
@@ -125,6 +125,9 @@
cube_size=level*level;
image->columns=(size_t) (level*cube_size);
image->rows=(size_t) (level*cube_size);
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
for (y=0; y < (ssize_t) image->rows; y+=(ssize_t) level)
{
ssize_t
diff --git a/coders/hdr.c b/coders/hdr.c
index 8c7aa7e..2729342 100644
--- a/coders/hdr.c
+++ b/coders/hdr.c
@@ -382,6 +382,9 @@
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Read RGBE (red+green+blue+exponent) pixels.
*/
diff --git a/coders/hrz.c b/coders/hrz.c
index 02144b5..c466391 100644
--- a/coders/hrz.c
+++ b/coders/hrz.c
@@ -142,6 +142,9 @@
image->columns=256;
image->rows=240;
image->depth=8;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
pixels=(unsigned char *) AcquireQuantumMemory(image->columns,3*
sizeof(*pixels));
if (pixels == (unsigned char *) NULL)
diff --git a/coders/icon.c b/coders/icon.c
index ba98a24..2769f5f 100644
--- a/coders/icon.c
+++ b/coders/icon.c
@@ -457,6 +457,9 @@
(image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
bytes_per_line=(((image->columns*icon_info.bits_per_pixel)+31) &
~31) >> 3;
(void) bytes_per_line;
diff --git a/coders/ipl.c b/coders/ipl.c
index 2d7adc3..a639754 100644
--- a/coders/ipl.c
+++ b/coders/ipl.c
@@ -304,19 +304,22 @@
/* Thats all we need if we are pinging. */
if (image_info->ping != MagickFalse)
- {
- (void) CloseBlob(image);
- return(GetFirstImageInList(image));
- }
+ {
+ (void) CloseBlob(image);
+ return(GetFirstImageInList(image));
+ }
length=image->columns;
quantum_type=GetQuantumType(image,exception);
do
{
SetHeaderFromIPL(image, &ipl_info);
- if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
+ if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
printf("Length: %.20g, Memory size: %.20g\n", (double) length,(double)
image->depth);
diff --git a/coders/jbig.c b/coders/jbig.c
index 3cf9f06..c8731b4 100644
--- a/coders/jbig.c
+++ b/coders/jbig.c
@@ -215,6 +215,9 @@
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Convert X bitmap image to pixel packets.
*/
diff --git a/coders/jp2.c b/coders/jp2.c
index 8bf7083..e77801a 100644
--- a/coders/jp2.c
+++ b/coders/jp2.c
@@ -398,6 +398,9 @@
image->columns=(size_t) jp2_image->comps[0].w;
image->rows=(size_t) jp2_image->comps[0].h;
image->depth=jp2_image->comps[0].prec;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
image->compression=JPEG2000Compression;
if (jp2_image->numcomps <= 2)
{
diff --git a/coders/jpeg.c b/coders/jpeg.c
index 8c700a8..b445ff4 100644
--- a/coders/jpeg.c
+++ b/coders/jpeg.c
@@ -1300,6 +1300,9 @@
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
memory_info=AcquireVirtualMemory((size_t) image->columns,
jpeg_info.output_components*sizeof(*jpeg_pixels));
if (memory_info == (MemoryInfo *) NULL)
diff --git a/coders/label.c b/coders/label.c
index 13dd66d..014d7a0 100644
--- a/coders/label.c
+++ b/coders/label.c
@@ -211,6 +211,9 @@
draw_info->stroke_width+0.5);
if (image->rows == 0)
image->rows=(size_t) (draw_info->pointsize+draw_info->stroke_width+0.5);
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
if (draw_info->gravity == UndefinedGravity)
{
(void) FormatLocaleString(geometry,MaxTextExtent,"%+g%+g",
diff --git a/coders/mac.c b/coders/mac.c
index ae66260..df20cf5 100644
--- a/coders/mac.c
+++ b/coders/mac.c
@@ -153,6 +153,9 @@
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Convert MAC raster image to pixel packets.
*/
diff --git a/coders/map.c b/coders/map.c
index 6512edb..797e1b3 100644
--- a/coders/map.c
+++ b/coders/map.c
@@ -203,6 +203,9 @@
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Read image pixels.
*/
diff --git a/coders/mat.c b/coders/mat.c
index d5b9e89..1bb112f 100644
--- a/coders/mat.c
+++ b/coders/mat.c
@@ -866,6 +866,9 @@
image->rows = temp;
goto done_reading; /* !!!!!! BAD !!!! */
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/* ----- Load raster data ----- */
BImgBuff = (unsigned char *) AcquireQuantumMemory((size_t) (ldblk),sizeof(unsigned char)); /* Ldblk was set in the check phase */
diff --git a/coders/miff.c b/coders/miff.c
index 20b739f..89a5f01 100644
--- a/coders/miff.c
+++ b/coders/miff.c
@@ -1241,6 +1241,9 @@
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Allocate image pixels.
*/
diff --git a/coders/mono.c b/coders/mono.c
index f8fb480..23237fb 100644
--- a/coders/mono.c
+++ b/coders/mono.c
@@ -151,6 +151,9 @@
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Convert bi-level image to pixel packets.
*/
diff --git a/coders/mpc.c b/coders/mpc.c
index ccaeecc..b29657b 100644
--- a/coders/mpc.c
+++ b/coders/mpc.c
@@ -922,6 +922,9 @@
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Attach persistent pixel cache.
*/
diff --git a/coders/mtv.c b/coders/mtv.c
index bb6e790..0036bbc 100644
--- a/coders/mtv.c
+++ b/coders/mtv.c
@@ -158,6 +158,9 @@
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Convert MTV raster image to pixel packets.
*/
diff --git a/coders/mvg.c b/coders/mvg.c
index 187bc07..5770805 100644
--- a/coders/mvg.c
+++ b/coders/mvg.c
@@ -189,6 +189,9 @@
DefaultResolution;
image->columns=(size_t) (draw_info->affine.sx*image->columns);
image->rows=(size_t) (draw_info->affine.sy*image->rows);
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
if (SetImageBackgroundColor(image,exception) == MagickFalse)
{
image=DestroyImageList(image);
diff --git a/coders/null.c b/coders/null.c
index 9d56aee..8c06970 100644
--- a/coders/null.c
+++ b/coders/null.c
@@ -99,6 +99,9 @@
Image
*image;
+ MagickBooleanType
+ status;
+
PixelInfo
background;
@@ -126,6 +129,9 @@
image->columns=1;
if (image->rows == 0)
image->rows=1;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
ConformPixelInfo(image,&image->background_color,&background,exception);
image->alpha_trait=BlendPixelTrait;
background.alpha=(double) TransparentAlpha;
diff --git a/coders/otb.c b/coders/otb.c
index bb352d8..d7f58b0 100644
--- a/coders/otb.c
+++ b/coders/otb.c
@@ -165,6 +165,9 @@
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Convert bi-level image to pixel packets.
*/
diff --git a/coders/palm.c b/coders/palm.c
index 0876352..97d201c 100644
--- a/coders/palm.c
+++ b/coders/palm.c
@@ -326,6 +326,9 @@
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
if ((image->columns == 0) || (image->rows == 0))
ThrowReaderException(CorruptImageError,"NegativeOrZeroImageSize");
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
bytes_per_row=ReadBlobMSBShort(image);
flags=ReadBlobMSBShort(image);
bits_per_pixel=(size_t) ReadBlobByte(image);
diff --git a/coders/pango.c b/coders/pango.c
index 7e2e5ba..0446e44 100644
--- a/coders/pango.c
+++ b/coders/pango.c
@@ -378,6 +378,9 @@
(image->resolution.y == 0.0 ? 90.0 : image->resolution.y)+45.0)/90.0+
0.5));
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Render markup.
*/
diff --git a/coders/pcd.c b/coders/pcd.c
index 766219f..a1b9d94 100644
--- a/coders/pcd.c
+++ b/coders/pcd.c
@@ -594,6 +594,9 @@
image->columns<<=1;
image->rows<<=1;
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Allocate luma and chroma memory.
*/
diff --git a/coders/pcx.c b/coders/pcx.c
index af394bc..e9861c0 100644
--- a/coders/pcx.c
+++ b/coders/pcx.c
@@ -392,6 +392,9 @@
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Read image data.
*/
diff --git a/coders/pdb.c b/coders/pdb.c
index 015727d..d5939ab 100644
--- a/coders/pdb.c
+++ b/coders/pdb.c
@@ -389,6 +389,9 @@
image->columns=(size_t) pdb_image.width;
image->rows=(size_t) pdb_image.height;
image->depth=8;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
image->storage_class=PseudoClass;
bits_per_pixel=pdb_image.type == 0 ? 2UL : pdb_image.type == 2 ? 4UL : 1UL;
one=1;
diff --git a/coders/pict.c b/coders/pict.c
index 83de827..33a69b2 100644
--- a/coders/pict.c
+++ b/coders/pict.c
@@ -918,6 +918,9 @@
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
if ((version == 1) || ((TellBlob(image) % 2) != 0))
code=ReadBlobByte(image);
if (version == 2)
diff --git a/coders/pix.c b/coders/pix.c
index 4b735ae..62085bf 100644
--- a/coders/pix.c
+++ b/coders/pix.c
@@ -156,6 +156,9 @@
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Convert PIX raster image to pixel packets.
*/
diff --git a/coders/psd.c b/coders/psd.c
index f97e449..0914625 100644
--- a/coders/psd.c
+++ b/coders/psd.c
@@ -1658,6 +1658,9 @@
image->depth=psd_info.depth;
image->columns=psd_info.columns;
image->rows=psd_info.rows;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
if (SetImageBackgroundColor(image,exception) == MagickFalse)
{
image=DestroyImageList(image);
diff --git a/coders/raw.c b/coders/raw.c
index ec0dd44..2b35ba5 100644
--- a/coders/raw.c
+++ b/coders/raw.c
@@ -182,6 +182,9 @@
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
if (scene == 0)
{
length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
diff --git a/coders/rgb.c b/coders/rgb.c
index 74eced2..1edfa5d 100644
--- a/coders/rgb.c
+++ b/coders/rgb.c
@@ -202,6 +202,9 @@
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
switch (image_info->interlace)
{
case NoInterlace:
diff --git a/coders/rgf.c b/coders/rgf.c
index 0e95bdc..21b6dda 100644
--- a/coders/rgf.c
+++ b/coders/rgf.c
@@ -168,8 +168,9 @@
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
-
-
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Read hex image data.
*/
diff --git a/coders/rla.c b/coders/rla.c
index ac0b452..f1f6015 100644
--- a/coders/rla.c
+++ b/coders/rla.c
@@ -262,6 +262,9 @@
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
scanlines=(ssize_t *) AcquireQuantumMemory(image->rows,sizeof(*scanlines));
if (scanlines == (ssize_t *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
diff --git a/coders/rle.c b/coders/rle.c
index a8ddac4..a05ed8c 100644
--- a/coders/rle.c
+++ b/coders/rle.c
@@ -290,6 +290,9 @@
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Allocate RLE pixels.
*/
diff --git a/coders/scr.c b/coders/scr.c
index 9b1f55e..7c68537 100644
--- a/coders/scr.c
+++ b/coders/scr.c
@@ -156,6 +156,9 @@
}
image->columns = 256;
image->rows = 192;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
count=ReadBlob(image,6144,(unsigned char *) zxscr);
(void) count;
count=ReadBlob(image,768,(unsigned char *) zxattr);
diff --git a/coders/screenshot.c b/coders/screenshot.c
index be93285..ce72e1e 100644
--- a/coders/screenshot.c
+++ b/coders/screenshot.c
@@ -133,6 +133,9 @@
int
i;
+ MagickBooleanType
+ status;
+
register Quantum
*q;
@@ -162,7 +165,9 @@
screen->columns=(size_t) GetDeviceCaps(hDC,HORZRES);
screen->rows=(size_t) GetDeviceCaps(hDC,VERTRES);
screen->storage_class=DirectClass;
-
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
if (image == (Image *) NULL)
image=screen;
else
diff --git a/coders/sct.c b/coders/sct.c
index a8d881b..caea07d 100644
--- a/coders/sct.c
+++ b/coders/sct.c
@@ -221,6 +221,9 @@
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Convert SCT raster image to pixel packets.
*/
diff --git a/coders/sgi.c b/coders/sgi.c
index a39d305..4da27dc 100644
--- a/coders/sgi.c
+++ b/coders/sgi.c
@@ -371,6 +371,9 @@
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Allocate SGI pixels.
*/
diff --git a/coders/sixel.c b/coders/sixel.c
index dd6371f..f903081 100644
--- a/coders/sixel.c
+++ b/coders/sixel.c
@@ -1024,6 +1024,9 @@
sixel_buffer=(char *) RelinquishMagickMemory(sixel_buffer);
image->depth=24;
image->storage_class=PseudoClass;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
if (AcquireImageColormap(image,image->colors, exception) == MagickFalse)
{
diff --git a/coders/stegano.c b/coders/stegano.c
index 679fde4..823d2ae 100644
--- a/coders/stegano.c
+++ b/coders/stegano.c
@@ -166,6 +166,9 @@
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Get hidden watermark from low-order bits of image.
*/
diff --git a/coders/sun.c b/coders/sun.c
index c9b8dda..2715795 100644
--- a/coders/sun.c
+++ b/coders/sun.c
@@ -413,6 +413,9 @@
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
if ((sun_info.length*sizeof(*sun_data))/sizeof(*sun_data) !=
sun_info.length || !sun_info.length)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
diff --git a/coders/svg.c b/coders/svg.c
index c18fb49..66601e2 100644
--- a/coders/svg.c
+++ b/coders/svg.c
@@ -2946,6 +2946,9 @@
image->columns=gdk_pixbuf_get_width(pixel_buffer);
image->rows=gdk_pixbuf_get_height(pixel_buffer);
#endif
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
image->alpha_trait=BlendPixelTrait;
SetImageProperty(image,"svg:base-uri",
rsvg_handle_get_base_uri(svg_handle),exception);
diff --git a/coders/tga.c b/coders/tga.c
index 6901212..2168fac 100644
--- a/coders/tga.c
+++ b/coders/tga.c
@@ -304,6 +304,9 @@
(void) CloseBlob(image);
return(image);
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
(void) ResetMagickMemory(&pixel,0,sizeof(pixel));
pixel.alpha=(MagickRealType) OpaqueAlpha;
if (tga_info.colormap_type != 0)
diff --git a/coders/tiff.c b/coders/tiff.c
index dd87750..b874bc4 100644
--- a/coders/tiff.c
+++ b/coders/tiff.c
@@ -1199,6 +1199,9 @@
image->columns=(size_t) width;
image->rows=(size_t) height;
image->depth=(size_t) bits_per_sample;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
if (image->debug != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),"Image depth: %.20g",
(double) image->depth);
diff --git a/coders/tile.c b/coders/tile.c
index aba6873..0341a56 100644
--- a/coders/tile.c
+++ b/coders/tile.c
@@ -94,6 +94,9 @@
ImageInfo
*read_info;
+ MagickBooleanType
+ status;
+
/*
Initialize Image structure.
*/
@@ -116,6 +119,9 @@
ThrowReaderException(OptionError,"MustSpecifyImageSize");
if (*image_info->filename == '\0')
ThrowReaderException(OptionError,"MustSpecifyAnImageName");
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
image->colorspace=tile_image->colorspace;
image->alpha_trait=tile_image->alpha_trait;
if (image->alpha_trait == BlendPixelTrait)
diff --git a/coders/tim.c b/coders/tim.c
index ca00282..4f26bc2 100644
--- a/coders/tim.c
+++ b/coders/tim.c
@@ -220,6 +220,9 @@
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Read image data.
*/
diff --git a/coders/ttf.c b/coders/ttf.c
index 4c3a412..2b4928e 100644
--- a/coders/ttf.c
+++ b/coders/ttf.c
@@ -224,6 +224,9 @@
image=DestroyImageList(image);
return((Image *) NULL);
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Color canvas with background color
*/
diff --git a/coders/txt.c b/coders/txt.c
index 0976bf7..7c4afdb 100644
--- a/coders/txt.c
+++ b/coders/txt.c
@@ -227,6 +227,9 @@
delta.x)+0.5);
image->rows=(size_t) floor((((double) page.height*image->resolution.y)/
delta.y)+0.5);
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
image->page.x=0;
image->page.y=0;
texture=(Image *) NULL;
@@ -433,6 +436,9 @@
image->rows=height;
for (depth=1; (GetQuantumRange(depth)+1) < max_value; depth++) ;
image->depth=depth;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
LocaleLower(colorspace);
i=(ssize_t) strlen(colorspace)-1;
image->alpha_trait=UndefinedPixelTrait;
diff --git a/coders/uyvy.c b/coders/uyvy.c
index d76288e..ebf9261 100644
--- a/coders/uyvy.c
+++ b/coders/uyvy.c
@@ -145,6 +145,9 @@
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Accumulate UYVY, then unpack into two pixels.
*/
diff --git a/coders/vicar.c b/coders/vicar.c
index 7800fbc..bfac89b 100644
--- a/coders/vicar.c
+++ b/coders/vicar.c
@@ -286,6 +286,9 @@
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Read VICAR pixels.
*/
diff --git a/coders/viff.c b/coders/viff.c
index 13b2e03..4ed285c 100644
--- a/coders/viff.c
+++ b/coders/viff.c
@@ -477,6 +477,9 @@
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Allocate VIFF pixels.
*/
diff --git a/coders/vips.c b/coders/vips.c
index 083b640..aebab80 100644
--- a/coders/vips.c
+++ b/coders/vips.c
@@ -412,6 +412,9 @@
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
image->columns=(size_t) ReadBlobLong(image);
image->rows=(size_t) ReadBlobLong(image);
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
channels=ReadBlobLong(image);
(void) ReadBlobLong(image); /* Legacy */
format=(VIPSBandFormat) ReadBlobLong(image);
diff --git a/coders/wbmp.c b/coders/wbmp.c
index acd2c2d..ee92c7d 100644
--- a/coders/wbmp.c
+++ b/coders/wbmp.c
@@ -182,6 +182,9 @@
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Convert bi-level image to pixel packets.
*/
diff --git a/coders/webp.c b/coders/webp.c
index d37a752..edbd913 100644
--- a/coders/webp.c
+++ b/coders/webp.c
@@ -285,6 +285,9 @@
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
webp_status=WebPDecode(stream,length,&configure);
}
if (webp_status != VP8_STATUS_OK)
diff --git a/coders/wmf.c b/coders/wmf.c
index 3b5a7bb..b2d9e6d 100644
--- a/coders/wmf.c
+++ b/coders/wmf.c
@@ -2565,6 +2565,9 @@
Image
*image;
+ MagickBooleanType
+ status;
+
unsigned long
wmf_options_flags = 0;
@@ -2857,6 +2860,9 @@
"leave ReadWMFImage()");
return(GetFirstImageInList(image));
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
if (image->debug != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Creating canvas image with size %lux%lu",(unsigned long) image->rows,
diff --git a/coders/wpg.c b/coders/wpg.c
index 0577a2c..736cd43 100644
--- a/coders/wpg.c
+++ b/coders/wpg.c
@@ -1403,6 +1403,9 @@
ThrowReaderException(CoderError,"DataEncodingSchemeIsNotSupported");
}
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
Finish:
(void) CloseBlob(image);
diff --git a/coders/xbm.c b/coders/xbm.c
index ae2c98b..826d4ab 100644
--- a/coders/xbm.c
+++ b/coders/xbm.c
@@ -288,6 +288,9 @@
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Initialize hex values.
*/
diff --git a/coders/xc.c b/coders/xc.c
index 47124cd..af996a4 100644
--- a/coders/xc.c
+++ b/coders/xc.c
@@ -124,6 +124,9 @@
image->columns=1;
if (image->rows == 0)
image->rows=1;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
(void) CopyMagickString(image->filename,image_info->filename,MaxTextExtent);
if (*image_info->filename == '\0')
pixel=image->background_color;
diff --git a/coders/xcf.c b/coders/xcf.c
index d007c91..b27d55f 100644
--- a/coders/xcf.c
+++ b/coders/xcf.c
@@ -1254,6 +1254,9 @@
XCFLayerInfo
*layer_info;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
the read pointer
*/
diff --git a/coders/xpm.c b/coders/xpm.c
index b78b0f9..72cd647 100644
--- a/coders/xpm.c
+++ b/coders/xpm.c
@@ -424,6 +424,9 @@
/*
Read image pixels.
*/
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
for (y=0; y < (ssize_t) image->rows; y++)
{
p=NextXPMLine(p);
diff --git a/coders/xwd.c b/coders/xwd.c
index 9531c14..cdb1bb1 100644
--- a/coders/xwd.c
+++ b/coders/xwd.c
@@ -396,6 +396,9 @@
image->columns=(size_t) ximage->width;
image->rows=(size_t) ximage->height;
image->depth=8;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
if ((header.ncolors == 0U) || (ximage->red_mask != 0) ||
(ximage->green_mask != 0) || (ximage->blue_mask != 0))
image->storage_class=DirectClass;
diff --git a/coders/ycbcr.c b/coders/ycbcr.c
index bc57872..af7cf6c 100644
--- a/coders/ycbcr.c
+++ b/coders/ycbcr.c
@@ -148,6 +148,9 @@
image=AcquireImage(image_info,exception);
if ((image->columns == 0) || (image->rows == 0))
ThrowReaderException(OptionError,"MustSpecifyImageSize");
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
SetImageColorspace(image,YCbCrColorspace,exception);
if (image_info->interlace != PartitionInterlace)
{
@@ -204,6 +207,9 @@
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
SetImageColorspace(image,YCbCrColorspace,exception);
switch (image_info->interlace)
{
diff --git a/coders/yuv.c b/coders/yuv.c
index 9085263..3ad280a 100644
--- a/coders/yuv.c
+++ b/coders/yuv.c
@@ -144,6 +144,9 @@
image=AcquireImage(image_info,exception);
if ((image->columns == 0) || (image->rows == 0))
ThrowReaderException(OptionError,"MustSpecifyImageSize");
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
quantum=image->depth <= 8 ? 1 : 2;
interlace=image_info->interlace;
horizontal_factor=2;
@@ -211,6 +214,9 @@
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
if (interlace == PartitionInterlace)
{
AppendImageFormat("Y",image->filename);