File ImageMagick-CVE-2021-20243.patch of Package ImageMagick.30356

From 9751bd619872c8e58609fbed56c4827afa083b40 Mon Sep 17 00:00:00 2001
From: ruc_zhangxiaohui <553441439@qq.com>
Date: Thu, 4 Feb 2021 04:20:35 +0800
Subject: [PATCH] uses the PerceptibleReciprocal() to prevent the
 divide-by-zero from occurring (#3193)

Co-authored-by: Zhang Xiaohui <ruc_zhangxiaohui@163.com>
---
 MagickCore/resize.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MagickCore/resize.c b/MagickCore/resize.c
index f309eb1ce8..1dc5c41d64 100644
--- a/MagickCore/resize.c
+++ b/MagickCore/resize.c
@@ -1656,7 +1656,7 @@ MagickPrivate double GetResizeFilterWeight(const ResizeFilter *resize_filter,
   */
   assert(resize_filter != (ResizeFilter *) NULL);
   assert(resize_filter->signature == MagickCoreSignature);
-  x_blur=fabs((double) x)/resize_filter->blur;  /* X offset with blur scaling */
+  x_blur=fabs((double) x)*PerceptibleReciprocal(resize_filter->blur);  /* X offset with blur scaling */
   if ((resize_filter->window_support < MagickEpsilon) ||
       (resize_filter->window == Box))
     scale=1.0;  /* Point or Box Filter -- avoid division by zero */

openSUSE Build Service is sponsored by