File: CVE-2021-20244.patch

package info (click to toggle)
imagemagick 8%3A6.9.11.60%2Bdfsg-1.6%2Bdeb12u3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 76,816 kB
  • sloc: ansic: 349,503; cpp: 21,804; xml: 11,029; perl: 6,417; sh: 5,877; makefile: 3,042; tcl: 459
file content (32 lines) | stat: -rw-r--r-- 1,499 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From c8d674946a687f40a126166edf470733fc8ede02 Mon Sep 17 00:00:00 2001
From: ruc_zhangxiaohui <553441439@qq.com>
Date: Thu, 4 Feb 2021 04:19:08 +0800
Subject: [PATCH] uses the PerceptibleReciprocal() to prevent the
 divide-by-zero from occurring (#3194)

Co-authored-by: Zhang Xiaohui <ruc_zhangxiaohui@163.com>
(cherry picked from commit 329dd528ab79531d884c0ba131e97d43f872ab5d)

This backports the fix for CVE-2021-20244 to IM6.
---
 magick/visual-effects.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- imagemagick-6.9.11.60+dfsg.orig/magick/visual-effects.c
+++ imagemagick-6.9.11.60+dfsg/magick/visual-effects.c
@@ -1101,11 +1101,11 @@ MagickExport Image *ImplodeImage(const I
           */
           factor=1.0;
           if (distance > 0.0)
-            factor=pow(sin((double) (MagickPI*sqrt((double) distance)/
-              radius/2)),-amount);
+            factor=pow(sin((double) (MagickPI*sqrt((double) distance)*
+              PerceptibleReciprocal(radius)/2)),-amount);
           status=InterpolateMagickPixelPacket(image,image_view,
-            UndefinedInterpolatePixel,(double) (factor*delta.x/scale.x+
-            center.x),(double) (factor*delta.y/scale.y+center.y),&pixel,
+            UndefinedInterpolatePixel,(double) (factor*delta.x*PerceptibleReciprocal(scale.x)+
+            center.x),(double) (factor*delta.y*PerceptibleReciprocal(scale.y)+center.y),&pixel,
             exception);
           if (status == MagickFalse)
             break;