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

diff --git a/MagickCore/histogram.c b/MagickCore/histogram.c
index a896b4c20b..3a9d88e127 100644
--- a/MagickCore/histogram.c
+++ b/MagickCore/histogram.c
@@ -987,12 +987,12 @@ static int HistogramCompare(const void *x,const void *y)
   color_1=(const PixelInfo *) x;
   color_2=(const PixelInfo *) y;
   if (color_2->red != color_1->red)
-    return((int) color_1->red-(int) color_2->red);
+    return((int) ((ssize_t) color_1->red-(ssize_t) color_2->red));
   if (color_2->green != color_1->green)
-    return((int) color_1->green-(int) color_2->green);
+    return((int) ((ssize_t) color_1->green-(ssize_t) color_2->green));
   if (color_2->blue != color_1->blue)
-    return((int) color_1->blue-(int) color_2->blue);
-  return((int) color_2->count-(int) color_1->count);
+    return((int) ((ssize_t) color_1->blue-(ssize_t) color_2->blue));
+  return((int) ((ssize_t) color_2->count-(ssize_t) color_1->count));
 }
 
 #if defined(__cplusplus) || defined(c_plusplus)

openSUSE Build Service is sponsored by