File ImageMagick-6.2.3-CVE-2007-4985.patch of Package ImageMagick
diff -r 6e2f7c2469aa coders/xcf.c
--- a/coders/xcf.c Fri Sep 28 03:02:20 2007 -0800
+++ b/coders/xcf.c Fri Sep 28 03:35:00 2007 -0800
@@ -944,6 +944,11 @@ static Image *ReadXCFImage(const ImageIn
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.
--- ImageMagick-6.2.8.orig/coders/dcm.c 2007-12-06 20:32:12.000000000 +0000
+++ ImageMagick-6.2.8/coders/dcm.c 2007-12-06 20:33:34.000000000 +0000
@@ -2900,10 +2900,10 @@ static Image *ReadDCMImage(const ImageIn
else
if ((quantum != 0) && (length != 0))
{
- data=(unsigned char *)
- AcquireMagickMemory((size_t) quantum*(length+1));
- if (length > ((~0UL)/quantum))
- ThrowReaderException(CorruptImageError,"ImproperImageHeader");
+ data=(unsigned char *) NULL;
+ if (~length >= 1)
+ data=(unsigned char *) AcquireQuantumMemory(length+1,quantum*
+ sizeof(*data));
if (data == (unsigned char *) NULL)
ThrowReaderException(ResourceLimitError,
"MemoryAllocationFailed");