File ImageMagick-6.2.5-CVE-2007-4985.patch of Package ImageMagick
--- ImageMagick-6.3.0/coders/dcm.c
+++ ImageMagick-6.3.0/coders/dcm.c
@@ -2900,11 +2900,10 @@
else
if ((quantum != 0) && (length != 0))
{
- /* new check for CVE-2007-1797 */
- if (length > ((~0UL)/quantum))
- ThrowReaderException(CorruptImageError,"ImproperImageHeader");
- data=(unsigned char *)
- AcquireMagickMemory((size_t) quantum*(length+1));
+ data=(unsigned char *) NULL;
+ if (~length >= 1)
+ data=(unsigned char *) AcquireQuantumMemory(length+1,quantum*
+ sizeof(*data));
if (data == (unsigned char *) NULL)
ThrowReaderException(ResourceLimitError,
"MemoryAllocationFailed");
--- ImageMagick-6.3.0/coders/xcf.c
+++ ImageMagick-6.3.0/coders/xcf.c
@@ -950,6 +950,11 @@
else
if ( image_type == GIMP_INDEXED )
ThrowReaderException(CoderError,"ColormapTypeNotSupported");
+ if (SetImageExtent(image,0,0) == MagickFalse)
+ {
+ InheritException(exception,&image->exception);
+ return(DestroyImageList(image));
+ }
SetImageBackgroundColor(image);
/*
Read properties.