imagemagick: patch CVE-2025-66628

Details: https://nvd.nist.gov/vuln/detail/CVE-2025-66628

Pick the patch that refers to the relevant github advisory[1]
explicitly in its commit message.

[1]: https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-6hjr-v6g4-3fm8

Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
Signed-off-by: Anuj Mittal <anuj.mittal@oss.qualcomm.com>
This commit is contained in:
Gyorgy Sarvari
2026-02-07 11:33:43 +01:00
committed by Anuj Mittal
parent 2073a86a79
commit 0923b77230
2 changed files with 28 additions and 0 deletions
@@ -0,0 +1,27 @@
From 3853a72088f6a72fe3d7405655d8f9cbed605e75 Mon Sep 17 00:00:00 2001
From: Dirk Lemstra <dirk@lemstra.org>
Date: Tue, 2 Dec 2025 22:49:12 +0100
Subject: [PATCH] Added extra check to avoid an overflow on 32-bit machines
(GHSA-6hjr-v6g4-3fm8)
CVE: CVE-2025-66628
Upstream-Status: Backport [https://github.com/ImageMagick/ImageMagick/commit/bdae0681ad1e572defe62df85834218f01e6d670]
Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
---
coders/tim.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/coders/tim.c b/coders/tim.c
index 4c094ac5f..fcfd9266f 100644
--- a/coders/tim.c
+++ b/coders/tim.c
@@ -231,7 +231,8 @@ static Image *ReadTIMImage(const ImageInfo *image_info,ExceptionInfo *exception)
(void) ReadBlobLSBShort(image);
width=ReadBlobLSBShort(image);
height=ReadBlobLSBShort(image);
- image_size=2*width*height;
+ if (HeapOverflowSanityCheckGetSize(2*width,height,&image_size) != MagickFalse)
+ ThrowReaderException(CorruptImageError,"ImproperImageHeader");
if (image_size > GetBlobSize(image))
ThrowReaderException(CorruptImageError,"InsufficientImageDataInFile");
bytes_per_line=width*2;
@@ -25,6 +25,7 @@ SRC_URI = "git://github.com/ImageMagick/ImageMagick.git;branch=main;protocol=htt
file://CVE-2025-57807.patch \
file://CVE-2025-62171.patch \
file://CVE-2025-65955.patch \
file://CVE-2025-66628.patch \
"
SRCREV = "82572afc879b439cbf8c9c6f3a9ac7626adf98fb"