File GraphicsMagick-CVE-2016-7537.patch of Package GraphicsMagick.6323

Index: GraphicsMagick-1.3.21/coders/pdb.c
===================================================================
--- GraphicsMagick-1.3.21.orig/coders/pdb.c	2016-10-10 10:27:33.431141482 +0200
+++ GraphicsMagick-1.3.21/coders/pdb.c	2016-10-10 10:28:03.355606832 +0200
@@ -456,7 +456,7 @@ static Image *ReadPDBImage(const ImageIn
 
   packets=MagickArraySize((MagickArraySize(bits_per_pixel,image->columns)+7)/8,
                           image->rows);
-  pixels=MagickAllocateMemory(unsigned char *,packets + (packets != 0 ? 256 : 0));
+  pixels=MagickAllocateMemory(unsigned char *,packets + (packets != 0 ? 257 : 0));
   if (pixels == (unsigned char *) NULL)
     ThrowReaderException(ResourceLimitWarning,MemoryAllocationFailed,image);
   switch (pdb_image.version)
@@ -868,7 +868,7 @@ static unsigned int WritePDBImage(const
   p=MagickAllocateMemory(unsigned char *,packets);
   if (p == (unsigned char *) NULL)
     ThrowWriterException(ResourceLimitWarning,MemoryAllocationFailed,image);
-  buffer=MagickAllocateMemory(unsigned char *,256);
+  buffer=MagickAllocateMemory(unsigned char *,257);
   if (buffer == (unsigned char *) NULL)
     ThrowWriterException(ResourceLimitWarning,MemoryAllocationFailed,image);
   packet_size=image->depth > 8 ? 2: 1;
openSUSE Build Service is sponsored by