File GraphicsMagick-CVE-2014-9817.patch of Package GraphicsMagick.6323
Index: GraphicsMagick-1.3.21/coders/pdb.c
===================================================================
--- GraphicsMagick-1.3.21.orig/coders/pdb.c 2016-08-05 10:05:55.877285090 +0200
+++ GraphicsMagick-1.3.21/coders/pdb.c 2016-08-05 10:07:17.194577936 +0200
@@ -454,7 +454,7 @@ static Image *ReadPDBImage(const ImageIn
if (CheckImagePixelLimits(image, exception) != MagickPass)
ThrowReaderException(ResourceLimitError,ImagePixelLimitExceeded,image);
- packets=MagickArraySize(MagickArraySize(bits_per_pixel,image->columns)/8+4,
+ packets=MagickArraySize((MagickArraySize(bits_per_pixel,image->columns)+7)/8,
image->rows);
pixels=MagickAllocateMemory(unsigned char *,packets + (packets != 0 ? 256 : 0));
if (pixels == (unsigned char *) NULL)
@@ -862,8 +862,8 @@ static unsigned int WritePDBImage(const
{
ThrowWriterException(CoderError,ImageColumnOrRowSizeIsNotSupported, image);
}
- packets=MagickArraySize(MagickArraySize(MagickArraySize(bits_per_pixel,
- pdb_image.width)/8,
+ packets=MagickArraySize(MagickArraySize((MagickArraySize(bits_per_pixel,
+ pdb_image.width)+7)/8,
pdb_image.height),2);
p=MagickAllocateMemory(unsigned char *,packets);
if (p == (unsigned char *) NULL)