File ImageMagick-CVE-2020-25665.patch of Package ImageMagick

Index: ImageMagick-6.8.8-1/coders/palm.c
===================================================================
--- ImageMagick-6.8.8-1.orig/coders/palm.c	2020-12-04 09:08:10.871139246 +0100
+++ ImageMagick-6.8.8-1/coders/palm.c	2020-12-04 09:09:12.987550891 +0100
@@ -758,7 +758,7 @@ static MagickBooleanType WritePALMImage(
     if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)
       (void) TransformImageColorspace(image,sRGBColorspace);
     count=GetNumberColors(image,NULL,&exception);
-    for (bits_per_pixel=1;  (one << bits_per_pixel) < count; bits_per_pixel*=2) ;
+    for (bits_per_pixel=1; (one << bits_per_pixel) < count; bits_per_pixel*=2) ;
     if (bits_per_pixel > 16)
       bits_per_pixel=16;
     else
@@ -858,7 +858,7 @@ static MagickBooleanType WritePALMImage(
     lastrow=(unsigned char *) NULL;
     if (image_info->compression == FaxCompression)
       {
-        lastrow=(unsigned char *) AcquireQuantumMemory(bytes_per_row,
+        lastrow=(unsigned char *) AcquireQuantumMemory(bytes_per_row+256,
           sizeof(*lastrow));
         if (lastrow == (unsigned char *) NULL)
         {
@@ -867,7 +867,7 @@ static MagickBooleanType WritePALMImage(
         }
       }
       /* TODO check whether memory really was acquired? */
-    one_row=(unsigned char *) AcquireQuantumMemory(bytes_per_row,
+    one_row=(unsigned char *) AcquireQuantumMemory(bytes_per_row+256,
       sizeof(*one_row));
     if (one_row == (unsigned char *) NULL)
       {
openSUSE Build Service is sponsored by