File ImageMagick-CVE-2014-9817.patch of Package ImageMagick.8212

Index: ImageMagick-6.8.9-8/coders/pdb.c
===================================================================
--- ImageMagick-6.8.9-8.orig/coders/pdb.c	2016-06-21 09:55:55.437333262 +0200
+++ ImageMagick-6.8.9-8/coders/pdb.c	2016-06-21 09:55:40.553094433 +0200
@@ -410,7 +410,7 @@ static Image *ReadPDBImage(const ImageIn
       (void) CloseBlob(image);
       return(GetFirstImageInList(image));
     }
-  packets=bits_per_pixel*image->columns/8;
+  packets=(bits_per_pixel*image->columns+7)/8;
   pixels=(unsigned char *) AcquireQuantumMemory(packets+256UL,image->rows*
     sizeof(*pixels));
   if (pixels == (unsigned char *) NULL)
@@ -809,7 +809,7 @@ static MagickBooleanType WritePDBImage(c
   if (image->columns % 16)
     pdb_image.width=(short) (16*(image->columns/16+1));
   pdb_image.height=(short) image->rows;
-  packets=(bits_per_pixel*image->columns/8+4)*image->rows;
+  packets=((bits_per_pixel*image->columns+7)/8)*image->rows;
   runlength=(unsigned char *) AcquireQuantumMemory(2UL*packets,
     sizeof(*runlength));
   if (runlength == (unsigned char *) NULL)