File: 0073-use-instead-to-work-around-precision-limitations-of-.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 (26 lines) | stat: -rw-r--r-- 907 bytes parent folder | download
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
From: Cristy <urban-warrior@imagemagick.org>
Date: Tue, 23 Apr 2024 11:39:48 -0400
Subject: use >= instead to work around precision limitations of a double.

This is needed for fixing CVE-2023-34151

Cast from double to integer is hard to correctly and was fixed by a few patches upstream.

origin: https://github.com/ImageMagick/ImageMagick6/commit/3252d4771ff1142888ba83c439588969fcea98e4.patch
---
 magick/image-private.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/magick/image-private.h b/magick/image-private.h
index 4e03993..bfe0a81 100644
--- a/magick/image-private.h
+++ b/magick/image-private.h
@@ -106,7 +106,7 @@ static inline size_t CastDoubleToUnsigned(const double x)
       return(0);
     }
   value=floor(x);
-  if (value > ((double) MAGICK_SIZE_MAX))
+  if (value >= ((double) MAGICK_SIZE_MAX))
     {
       errno=ERANGE;
       return((size_t) MAGICK_SIZE_MAX);