File ImageMagick-6.2.8-cve-2006-5456.patch of Package ImageMagick
--- ImageMagick-6.2.8/coders/dcm.c~ 2004-08-30 07:33:02.000000000 +1000
+++ ImageMagick-6.2.8/coders/dcm.c 2006-11-02 16:10:42.000000000 +1000
@@ -3027,7 +3027,7 @@ static Image *ReadDCMImage(const ImageIn
/*
Photometric interpretation.
*/
- for (i=0; i < (long) length; i++)
+ for (i=0; i < (long) Min(length, MaxTextExtent-1); i++)
photometric[i]=(char) data[i];
photometric[i]='\0';
break;
--- ImageMagick-6.2.8/coders/palm.c~ 2006-11-15 16:41:41.000000000 +1000
+++ ImageMagick-6.2.8/coders/palm.c 2006-11-15 16:44:09.000000000 +1000
@@ -399,7 +399,7 @@ static Image *ReadPALMImage(const ImageI
for (i=0; i < (long) bytes_per_row; )
{
count=ReadBlobByte(image);
- byte=ReadBlobByte(image);
+ byte=Min(ReadBlobByte(image),bytes_per_row-i);
(void) ResetMagickMemory(one_row+i,(int) byte,count);
i+=count;
}
@@ -431,6 +431,8 @@ static Image *ReadPALMImage(const ImageI
indexes=GetIndexes(image);
if (bits_per_pixel == 16)
{
+ if (image->columns > 2*bytes_per_row)
+ ThrowReaderException(CorruptImageError,"CorruptImage");
for (x=0; x < (long) image->columns; x++)
{
color16=(*ptr++ << 8);
@@ -447,6 +449,8 @@ static Image *ReadPALMImage(const ImageI
bit=8-bits_per_pixel;
for (x=0; x < (long) image->columns; x++)
{
+ if (ptr - one_row >= bytes_per_row)
+ ThrowReaderException(CorruptImageError,"CorruptImage");
index=(IndexPacket) (mask-(((*ptr) & (mask << bit)) >> bit));
indexes[x]=index;
*q++=image->colormap[index];