File ImageMagick-CVE-2021-20241.patch of Package ImageMagick.30356
From dd33b451c3e01098efad34bbaca2df78d5391dc8 Mon Sep 17 00:00:00 2001
From: Cristy <mikayla-grace@urban-warrior.org>
Date: Wed, 3 Feb 2021 15:30:59 -0500
Subject: [PATCH] https://github.com/ImageMagick/ImageMagick/pull/3177
---
MagickCore/thread-private.h | 6 +++---
coders/jp2.c | 6 ++++--
2 files changed, 7 insertions(+), 5 deletions(-)
Index: ImageMagick-7.0.7-34/coders/jp2.c
===================================================================
--- ImageMagick-7.0.7-34.orig/coders/jp2.c 2021-02-23 11:50:03.308223850 +0100
+++ ImageMagick-7.0.7-34/coders/jp2.c 2021-02-23 11:50:03.988228530 +0100
@@ -1015,8 +1015,10 @@ static MagickBooleanType WriteJP2Image(c
*q;
scale=(double) ((1UL << jp2_image->comps[i].prec)-1)/QuantumRange;
- q=jp2_image->comps[i].data+(y/jp2_image->comps[i].dy*
- image->columns/jp2_image->comps[i].dx+x/jp2_image->comps[i].dx);
+ q=jp2_image->comps[i].data+(ssize_t) (y*PerceptibleReciprocal(
+ jp2_image->comps[i].dy)*image->columns*PerceptibleReciprocal(
+ jp2_image->comps[i].dx)+x*PerceptibleReciprocal(
+ jp2_image->comps[i].dx));
switch (i)
{
case 0: