File ImageMagick-CVE-2019-11505.patch of Package ImageMagick.17846

Index: ImageMagick-7.0.7-34/coders/pdb.c
===================================================================
--- ImageMagick-7.0.7-34.orig/coders/pdb.c	2019-04-29 16:23:43.285754899 +0200
+++ ImageMagick-7.0.7-34/coders/pdb.c	2019-04-29 16:23:43.469756055 +0200
@@ -857,7 +857,7 @@ static MagickBooleanType WritePDBImage(c
     pdb_image.width=(short) (16*(image->columns/16+1));
   pdb_image.height=(short) image->rows;
   packets=((bits_per_pixel*image->columns+7)/8);
-  packet_size=(size_t) (image->depth > 8 ? 2 : 1);
+  packet_size=(size_t) (bits_per_pixel > 8 ? 2 : 1);
   runlength=(unsigned char *) AcquireQuantumMemory(9UL*packets,
     image->rows*sizeof(*runlength));
   buffer=(unsigned char *) AcquireQuantumMemory(512,sizeof(*buffer));
@@ -889,7 +889,7 @@ static MagickBooleanType WritePDBImage(c
       scanline=(unsigned char *) RelinquishMagickMemory(scanline);
       ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
     }
-  status=SetQuantumDepth(image,quantum_info,image->depth > 8 ? 16 : 8);
+  status=SetQuantumDepth(image,quantum_info,bits_per_pixel > 8 ? 16 : 8);
   bits=8/(int) bits_per_pixel-1;  /* start at most significant bits */
   literal=0;
   repeat=0;
openSUSE Build Service is sponsored by