File ImageMagick-CVE-2018-11625.patch of Package ImageMagick.28258

diff --git a/MagickCore/quantize.c b/MagickCore/quantize.c
index f4bc0e6b0c..4f2e831870 100644
--- a/MagickCore/quantize.c
+++ b/MagickCore/quantize.c
@@ -3319,10 +3319,10 @@ static MagickBooleanType SetGrayscaleImage(Image *image,
   if (image->type != GrayscaleType)
     (void) TransformImageColorspace(image,GRAYColorspace,exception);
   if (image->storage_class == PseudoClass)
-    colormap_index=(ssize_t *) AcquireQuantumMemory(image->colors,
+    colormap_index=(ssize_t *) AcquireQuantumMemory(image->colors+1,
       sizeof(*colormap_index));
   else
-    colormap_index=(ssize_t *) AcquireQuantumMemory(MaxColormapSize,
+    colormap_index=(ssize_t *) AcquireQuantumMemory(MaxColormapSize+1,
       sizeof(*colormap_index));
   if (colormap_index == (ssize_t *) NULL)
     ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",

openSUSE Build Service is sponsored by