File ImageMagick-CVE-2020-27765.patch of Package ImageMagick.30356

Index: ImageMagick-7.0.7-34/MagickCore/segment.c
===================================================================
--- ImageMagick-7.0.7-34.orig/MagickCore/segment.c	2018-05-20 17:55:43.000000000 +0200
+++ ImageMagick-7.0.7-34/MagickCore/segment.c	2020-12-08 17:50:30.980039213 +0100
@@ -562,7 +562,7 @@ static MagickBooleanType Classify(Image
       }
     for (x=0; x < (ssize_t) image->columns; x++)
     {
-      SetPixelIndex(image,0,q);
+      SetPixelIndex(image,(Quantum) 0,q);
       for (clust=head; clust != (Cluster *) NULL; clust=clust->next)
       {
         if (((ssize_t) ScaleQuantumToChar(GetPixelRed(image,q)) >=
@@ -1679,7 +1679,7 @@ static double OptimalTau(const ssize_t *
   average_tau=0.0;
   for (i=0; i < number_nodes; i++)
     average_tau+=list[i]->tau;
-  average_tau/=(double) number_nodes;
+  average_tau*=PerceptibleReciprocal((double) number_nodes);
   /*
     Relinquish resources.
   */
openSUSE Build Service is sponsored by