ImageMagick: Fix CVE-2025-55004

Backport the fix for CVE-2025-55004

Upstream-Status: Backport [https://github.com/ImageMagick/ImageMagick/commit/55d97055e00a7bc7ae2776c99824002fbb4a72aa]

Add below patch to fix
0006-ImageMagick-Fix-CVE-2025-55004.patch

Signed-off-by: Divyanshu Rathore <Divyanshu.Rathore@bmwtechworks.in>
Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
This commit is contained in:
Divyanshu Rathore
2025-12-12 20:29:42 +05:30
committed by Gyorgy Sarvari
parent a1c2509aea
commit 222e1b635e
2 changed files with 68 additions and 0 deletions
@@ -0,0 +1,67 @@
From 13089a79a67ed0f1408fdee09f89e6e2497f10c6 Mon Sep 17 00:00:00 2001
From: Divyanshu Rathore <Divyanshu.Rathore@bmwtechworks.in>
Date: Tue, 28 Oct 2025 13:55:50 +0530
Subject: [PATCH 06/18] ImageMagick: Fix CVE-2025-55004
CVE: CVE-2025-55004
Upstream-Status: Backport [https://github.com/ImageMagick/ImageMagick/commit/55d97055e00a7bc7ae2776c99824002fbb4a72aa]
Reference: https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-cjc8-g9w8-chfw
Comment: Refreshed hunk to match latest kirkstone
Signed-off-by: Divyanshu Rathore <Divyanshu.Rathore@bmwtechworks.in>
---
coders/png.c | 29 ++++++++++-------------------
1 file changed, 10 insertions(+), 19 deletions(-)
diff --git a/coders/png.c b/coders/png.c
index dbab45e60..343934ce8 100644
--- a/coders/png.c
+++ b/coders/png.c
@@ -5113,33 +5113,24 @@ static Image *ReadOneJNGImage(MngInfo *m
jng_image=ReadImage(alpha_image_info,exception);
if (jng_image != (Image *) NULL)
- for (y=0; y < (ssize_t) image->rows; y++)
{
- s=GetVirtualPixels(jng_image,0,y,image->columns,1,exception);
- q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
- if ((s == (const Quantum *) NULL) || (q == (Quantum *) NULL))
- break;
+ image->alpha_trait=BlendPixelTrait;
+ for (y=0; y < (ssize_t) image->rows; y++)
+ {
+ s=GetVirtualPixels(jng_image,0,y,image->columns,1,exception);
+ q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
+ if ((s == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+ break;
- if (image->alpha_trait != UndefinedPixelTrait)
for (x=(ssize_t) image->columns; x != 0; x--)
{
SetPixelAlpha(image,GetPixelRed(jng_image,s),q);
q+=GetPixelChannels(image);
s+=GetPixelChannels(jng_image);
}
-
- else
- for (x=(ssize_t) image->columns; x != 0; x--)
- {
- SetPixelAlpha(image,GetPixelRed(jng_image,s),q);
- if (GetPixelAlpha(image,q) != OpaqueAlpha)
- image->alpha_trait=BlendPixelTrait;
- q+=GetPixelChannels(image);
- s+=GetPixelChannels(jng_image);
- }
-
- if (SyncAuthenticPixels(image,exception) == MagickFalse)
- break;
+ if (SyncAuthenticPixels(image,exception) == MagickFalse)
+ break;
+ }
}
(void) RelinquishUniqueFileResource(alpha_image->filename);
alpha_image=DestroyImageList(alpha_image);
--
2.34.1
@@ -31,6 +31,7 @@ SRC_URI = "git://github.com/ImageMagick/ImageMagick.git;branch=main;protocol=htt
file://0003-ImageMagick-Fix-CVE-2025-55160.patch \
file://0004-ImageMagick-Fix-CVE-2025-55005.patch \
file://0005-ImageMagick-Fix-CVE-2025-53019.patch \
file://0006-ImageMagick-Fix-CVE-2025-55004.patch \
"
SRCREV = "35b4991eb0939a327f3489988c366e21068b0178"