Skip to contentSkip to conversation

gimp: patch CVE-2025-2760

PATCH In review Gyorgy Sarvari 2 participants 9 messages Mar 5 – Mar 24

lore
Share & tools
lore
#0 lore raw

PATCH 1/7 gimp: patch CVE-2025-2760

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

Use the fixes from Debian.

---
 .../gimp/gimp/CVE-2025-2760-1.patch           | 38 +++++++++
 .../gimp/gimp/CVE-2025-2760-2.patch           | 84 +++++++++++++++++++
 meta-gnome/recipes-gimp/gimp/gimp_2.10.38.bb  |  2 +
 3 files changed, 124 insertions(+)
 create mode 100644 meta-gnome/recipes-gimp/gimp/gimp/CVE-2025-2760-1.patch
 create mode 100644 meta-gnome/recipes-gimp/gimp/gimp/CVE-2025-2760-2.patch
meta-gnome/recipes-gimp/gimp/gimp/CVE-2025-2760-1.patch new file +38 -0
new file mode 100644
index 0000000000..d5871958b4
@@ -0,0 +1,38 @@
+From e4e21387f773598915a2399b348d019fd9c26ad6 Mon Sep 17 00:00:00 2001
+From: Gyorgy Sarvari <[email protected]>
+Date: Thu, 5 Mar 2026 09:06:34 +0100
+Subject: [PATCH] CVE-2025-2760
+
+https://gitlab.gnome.org/GNOME/gimp/-/issues/12790#note_2328950
+
+Gimp stopped supporting 2.10.x series (in favor of 3.x), and they do not
+plan to fix this in the old version. This patch is taken from Debian,
+and is a backport of the fix from 3.x series.
+
+CVE: CVE-2025-2760
+Upstream-Status: Inappropriate [unsupported version. Debian ref: https://sources.debian.org/patches/gimp/2.10.34-1+deb12u8/CVE-2025-2760.patch/]
+
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ plug-ins/file-dds/ddsread.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/plug-ins/file-dds/ddsread.c b/plug-ins/file-dds/ddsread.c
+index dcb4449..da35a0b 100644
+--- a/plug-ins/file-dds/ddsread.c
++++ b/plug-ins/file-dds/ddsread.c
+@@ -934,6 +934,14 @@ load_layer (FILE            *fp,
+   if (width < 1) width = 1;
+   if (height < 1) height = 1;
+ 
++  if (width <= 0 ||height <= 0 || d->gimp_bpp <= 0 ||
++      (gsize) width > G_MAXSIZE / height           ||
++      (gsize) width * height > G_MAXSIZE / d->gimp_bpp)
++    { 
++      g_message ("Invalid dimensions in header.");
++      return 0;
++    }
++  
+   switch (d->bpp)
+     {
+     case 1:
meta-gnome/recipes-gimp/gimp/gimp/CVE-2025-2760-2.patch new file +84 -0

84 lines not on this page · raw message

meta-gnome/recipes-gimp/gimp/gimp_2.10.38.bb +2 -0
index 95a6dfd7c8..afb1cd69e5 100644
@@ -51,6 +51,8 @@ SRC_URI = "https://download.gimp.org/pub/${BPN}/v${SHPV}/${BP}.tar.bz2 \
            file://CVE-2025-14425.patch \
            file://CVE-2025-5473.patch \
            file://CVE-2025-15059.patch \
+           file://CVE-2025-2760-1.patch \
+           file://CVE-2025-2760-2.patch \
            "
 SRC_URI[sha256sum] = "50a845eec11c8831fe8661707950f5b8446e35f30edfb9acf98f85c1133f856e"
 
#1 lore raw

PATCH 2/7 gimp: patch CVE-2025-2761

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

Pick the patch from the relevant upstream bug[1].

[1]: https://gitlab.gnome.org/GNOME/gimp/-/issues/13073

---
 .../gimp/gimp/CVE-2025-2761.patch             | 34 +++++++++++++++++++
 meta-gnome/recipes-gimp/gimp/gimp_2.10.38.bb  |  1 +
 2 files changed, 35 insertions(+)
 create mode 100644 meta-gnome/recipes-gimp/gimp/gimp/CVE-2025-2761.patch
meta-gnome/recipes-gimp/gimp/gimp/CVE-2025-2761.patch new file +34 -0
new file mode 100644
index 0000000000..670f6d9269
@@ -0,0 +1,34 @@
+From 658a8a07b831b82bd9e9592c18f21e4d4d7392af Mon Sep 17 00:00:00 2001
+From: Alx Sa <[email protected]>
+Date: Mon, 10 Mar 2025 04:07:44 +0000
+Subject: [PATCH] plug-ins: Fix ZDI-CAN-25100 for FLI plug-in
+
+Resolves #13073
+This patch adds a check to make sure we're not
+writing beyond the bounds of the "pos" array.
+This is the same check that we do earlier when
+writing pos[xc++], but it was left off of the last
+write command. Since "n" will be 0 if we get to the
+end of the array, it prevents us from writing beyond
+that.
+
+CVE: CVE-2025-2761
+Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/gimp/-/commit/0806bc76ca74543d20e1307ccf6aebd26395c56c]
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ plug-ins/file-fli/fli.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/plug-ins/file-fli/fli.c b/plug-ins/file-fli/fli.c
+index c2e28e4..209b5ec 100644
+--- a/plug-ins/file-fli/fli.c
++++ b/plug-ins/file-fli/fli.c
+@@ -1026,7 +1026,7 @@ fli_read_lc_2 (FILE          *f,
+               xc += len << 1;
+             }
+         }
+-      if (lpf)
++      if (lpf && xc < n)
+         pos[xc] = lpn;
+       yc++;
+     }
meta-gnome/recipes-gimp/gimp/gimp_2.10.38.bb +1 -0
index afb1cd69e5..a04b3d0e4c 100644
@@ -53,6 +53,7 @@ SRC_URI = "https://download.gimp.org/pub/${BPN}/v${SHPV}/${BP}.tar.bz2 \
            file://CVE-2025-15059.patch \
            file://CVE-2025-2760-1.patch \
            file://CVE-2025-2760-2.patch \
+           file://CVE-2025-2761.patch \
            "
 SRC_URI[sha256sum] = "50a845eec11c8831fe8661707950f5b8446e35f30edfb9acf98f85c1133f856e"
 
#2 lore raw

PATCH 3/7 gimp: patch CVE-2026-0797

In reply to Gyorgy Sarvari

Details: https://nvd.nist.gov/vuln/detail/CVE-2026-0797

The patch referenced in the NVD report looks incorrect.
This change in this patch was taken from the related upstream issue[1].

[1]: https://gitlab.gnome.org/GNOME/gimp/-/issues/15555

---
 .../gimp/gimp/CVE-2026-0797.patch             | 91 +++++++++++++++++++
 meta-gnome/recipes-gimp/gimp/gimp_2.10.38.bb  |  1 +
 2 files changed, 92 insertions(+)
 create mode 100644 meta-gnome/recipes-gimp/gimp/gimp/CVE-2026-0797.patch
meta-gnome/recipes-gimp/gimp/gimp/CVE-2026-0797.patch new file +91 -0
new file mode 100644
index 0000000000..46e83ac30c
@@ -0,0 +1,91 @@
+From b00dbb729ef8218ffadc3ddeee6841b8ffb1b7ea Mon Sep 17 00:00:00 2001
+From: Alx Sa <[email protected]>
+Date: Fri, 26 Dec 2025 15:49:45 +0000
+Subject: [PATCH] plug-ins: Add more fread () checks in ICO loading
+
+Resolves #15555
+
+This patch adds some guards for ico_read_int8 (),
+which was used for loading palettes and maps
+without verifying that it returned the same number
+of bytes as what it tried to read in.
+
+CVE: CVE-2026-0797
+Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/gimp/-/commit/09e72ef32bf47dea047b044dba789557f334b7d5]
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ plug-ins/file-ico/ico-load.c | 33 ++++++++++++++++++++++++++-------
+ 1 file changed, 26 insertions(+), 7 deletions(-)
+
+diff --git a/plug-ins/file-ico/ico-load.c b/plug-ins/file-ico/ico-load.c
+index c144b6e..7eb9cb7 100644
+--- a/plug-ins/file-ico/ico-load.c
++++ b/plug-ins/file-ico/ico-load.c
+@@ -69,7 +69,9 @@ ico_read_int32 (FILE    *fp,
+   total = count;
+   if (count > 0)
+     {
+-      ico_read_int8 (fp, (guint8 *) data, count * 4);
++      if (ico_read_int8 (fp, (guint8 *) data, count * 4) != (count * 4))
++        return FALSE;
++
+       for (i = 0; i < count; i++)
+         data[i] = GUINT32_FROM_LE (data[i]);
+     }
+@@ -88,7 +90,9 @@ ico_read_int16 (FILE    *fp,
+   total = count;
+   if (count > 0)
+     {
+-      ico_read_int8 (fp, (guint8 *) data, count * 2);
++      if (ico_read_int8 (fp, (guint8 *) data, count * 2) != (count * 2))
++        return FALSE;
++
+       for (i = 0; i < count; i++)
+         data[i] = GUINT16_FROM_LE (data[i]);
+     }
+@@ -109,8 +113,8 @@ ico_read_int8 (FILE   *fp,
+   while (count > 0)
+     {
+       bytes = fread ((gchar *) data, sizeof (gchar), count, fp);
+-      if (bytes <= 0) /* something bad happened */
+-        break;
++      if (bytes != count) /* something bad happened */
++        return -1;
+ 
+       count -= bytes;
+       data += bytes;
+@@ -485,16 +489,31 @@ ico_read_icon (FILE    *fp,
+          data.used_clrs, data.bpp));
+ 
+       palette = g_new0 (guint32, data.used_clrs);
+-      ico_read_int8 (fp, (guint8 *) palette, data.used_clrs * 4);
++      if (ico_read_int8 (fp,
++                         (guint8 *) palette,
++                         data.used_clrs * 4) != (data.used_clrs * 4))
++        {
++          D(("skipping image: too large\n"));
++          return FALSE;
++        }
++
+     }
+ 
+   xor_map = ico_alloc_map (w, h, data.bpp, &length);
+-  ico_read_int8 (fp, xor_map, length);
++  if (ico_read_int8 (fp, xor_map, length) != length)
++    {
++      D(("skipping image: too large\n"));
++      return FALSE;
++    }
+   D(("  length of xor_map: %i\n", length));
+ 
+   /* Read in and_map. It's padded out to 32 bits per line: */
+   and_map = ico_alloc_map (w, h, 1, &length);
+-  ico_read_int8 (fp, and_map, length);
++  if (! ico_read_int8 (fp, and_map, length) != length)
++    {
++      D(("skipping image: too large\n"));
++      return FALSE;
++    }
+   D(("  length of and_map: %i\n", length));
+ 
+   dest_vec = (guint32 *) buf;
meta-gnome/recipes-gimp/gimp/gimp_2.10.38.bb +1 -0
index a04b3d0e4c..9a969bde7c 100644
@@ -54,6 +54,7 @@ SRC_URI = "https://download.gimp.org/pub/${BPN}/v${SHPV}/${BP}.tar.bz2 \
            file://CVE-2025-2760-1.patch \
            file://CVE-2025-2760-2.patch \
            file://CVE-2025-2761.patch \
+           file://CVE-2026-0797.patch \
            "
 SRC_URI[sha256sum] = "50a845eec11c8831fe8661707950f5b8446e35f30edfb9acf98f85c1133f856e"
 
#3 lore raw

PATCH 4/7 gimp: patch CVE-2026-2044

In reply to Gyorgy Sarvari

Details: https://nvd.nist.gov/vuln/detail/CVE-2026-2044

Pick the patch referenced by the NVD advisory.

---
 .../gimp/gimp/CVE-2026-2044.patch             | 28 +++++++++++++++++++
 meta-gnome/recipes-gimp/gimp/gimp_2.10.38.bb  |  1 +
 2 files changed, 29 insertions(+)
 create mode 100644 meta-gnome/recipes-gimp/gimp/gimp/CVE-2026-2044.patch
meta-gnome/recipes-gimp/gimp/gimp/CVE-2026-2044.patch new file +28 -0
new file mode 100644
index 0000000000..102dc155da
@@ -0,0 +1,28 @@
+From af312f516e23521e1d03255263b22ef4b99761d5 Mon Sep 17 00:00:00 2001
+From: Gabriele Barbero <[email protected]>
+Date: Fri, 5 Dec 2025 19:13:01 +0100
+Subject: [PATCH] ZDI-CAN-28158: use g_malloc0 instead of g_malloc
+
+To avoid accessing uninitialized memory, replace calls to g_malloc with
+g_malloc0 which initializes the allocated memory to zero.
+
+CVE: CVE-2026-2044
+Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/gimp/-/commit/112a5e038f0646eae5ae314988ec074433d2b365]
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ plug-ins/common/file-pnm.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/plug-ins/common/file-pnm.c b/plug-ins/common/file-pnm.c
+index f514c2b..c82720c 100644
+--- a/plug-ins/common/file-pnm.c
++++ b/plug-ins/common/file-pnm.c
+@@ -571,7 +571,7 @@ load_image (GFile   *file,
+     return -1;
+ 
+   /* allocate the necessary structures */
+-  pnminfo = g_new (PNMInfo, 1);
++  pnminfo = g_new0 (PNMInfo, 1);
+ 
+   scan = NULL;
+   /* set error handling */
meta-gnome/recipes-gimp/gimp/gimp_2.10.38.bb +1 -0
index 9a969bde7c..4f273a7cbb 100644
@@ -55,6 +55,7 @@ SRC_URI = "https://download.gimp.org/pub/${BPN}/v${SHPV}/${BP}.tar.bz2 \
            file://CVE-2025-2760-2.patch \
            file://CVE-2025-2761.patch \
            file://CVE-2026-0797.patch \
+           file://CVE-2026-2044.patch \
            "
 SRC_URI[sha256sum] = "50a845eec11c8831fe8661707950f5b8446e35f30edfb9acf98f85c1133f856e"
 
#4 lore raw

PATCH 5/7 gimp: patch CVE-2026-2045

In reply to Gyorgy Sarvari

Details: https://nvd.nist.gov/vuln/detail/CVE-2026-2045

Pick the patch associated with the relevant upstream issue[1].

[1]: https://gitlab.gnome.org/GNOME/gimp/-/issues/15293

---
 .../gimp/gimp/CVE-2026-2045.patch             | 36 +++++++++++++++++++
 meta-gnome/recipes-gimp/gimp/gimp_2.10.38.bb  |  1 +
 2 files changed, 37 insertions(+)
 create mode 100644 meta-gnome/recipes-gimp/gimp/gimp/CVE-2026-2045.patch
meta-gnome/recipes-gimp/gimp/gimp/CVE-2026-2045.patch new file +36 -0
new file mode 100644
index 0000000000..c084b5704f
@@ -0,0 +1,36 @@
+From 584e67bdd529ab37b50eeba7e62e975af8c6d617 Mon Sep 17 00:00:00 2001
+From: Jacob Boerema <[email protected]>
+Date: Thu, 15 Jan 2026 10:12:07 -0500
+Subject: [PATCH] plug-ins: fix #15293 security issue ZDI-CAN-28265
+
+Just like we did in commit 4eb106f2bff2d9b8e518aa455a884c6f38d70c6a
+we need to make sure that the offset in the colormap is valid before
+using it, before using it to compute the RGB values.
+
+CVE: CVE-2026-2045
+Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/gimp/-/commit/68b27dfb1cbd9b3f22d7fa624dbab8647ee5f275]
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ plug-ins/common/file-xwd.c | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/plug-ins/common/file-xwd.c b/plug-ins/common/file-xwd.c
+index 53e4cd2..8ab11c0 100644
+--- a/plug-ins/common/file-xwd.c
++++ b/plug-ins/common/file-xwd.c
+@@ -1624,7 +1624,14 @@ load_xwd_f2_d16_b16 (const gchar     *filename,
+ 
+   for (j = 0; j < ncols; j++)
+     {
+-      cm = ColorMap + xwdcolmap[j].l_pixel * 3;
++      goffset offset = xwdcolmap[j].l_pixel * 3;
++
++      if (offset+2 >= maxval)
++        {
++          g_message (_("Invalid colormap offset. Possibly corrupt image."));
++          return NULL;
++        }
++      cm = ColorMap + offset;
+       *(cm++) = (xwdcolmap[j].l_red >> 8);
+       *(cm++) = (xwdcolmap[j].l_green >> 8);
+       *cm = (xwdcolmap[j].l_blue >> 8);
meta-gnome/recipes-gimp/gimp/gimp_2.10.38.bb +1 -0
index 4f273a7cbb..d38160a864 100644
@@ -56,6 +56,7 @@ SRC_URI = "https://download.gimp.org/pub/${BPN}/v${SHPV}/${BP}.tar.bz2 \
            file://CVE-2025-2761.patch \
            file://CVE-2026-0797.patch \
            file://CVE-2026-2044.patch \
+           file://CVE-2026-2045.patch \
            "
 SRC_URI[sha256sum] = "50a845eec11c8831fe8661707950f5b8446e35f30edfb9acf98f85c1133f856e"
 
#5 lore raw

PATCH 6/7 gimp: ignore CVE-2026-2047

In reply to Gyorgy Sarvari

Details: https://nvd.nist.gov/vuln/detail/CVE-2026-2047

The vulnerability exists in ICNS importer, which was first introduced in version 3.0 [1], and the code is not present in the recipe version.

Due to this, ignore this CVE.

[1]: https://gitlab.gnome.org/GNOME/gimp/-/commit/00232e17875d4676a2c797a429db23b1a9815db8

---
 meta-gnome/recipes-gimp/gimp/gimp_2.10.38.bb | 1 +
 1 file changed, 1 insertion(+)
meta-gnome/recipes-gimp/gimp/gimp_2.10.38.bb +1 -0
index d38160a864..8b3dd4aa5f 100644
@@ -86,3 +86,4 @@ CVE_STATUS[CVE-2007-3741] = "not-applicable-platform: This only applies for Mand
 CVE_STATUS[CVE-2025-48796] = "cpe-incorrect: The current version (2.10.38) is not affected."
 CVE_STATUS[CVE-2025-14423] = "cpe-incorrect: The vulnerability was introduced in v3.0"
 CVE_STATUS[CVE-2025-14424] = "cpe-incorrect: The vulnerability was introduced in v3.0"
+CVE_STATUS[CVE-2025-2047] = "cpe-incorrect: The vulnerability was introduced in v3.0"
#6 lore raw

Re: [oe] [meta-gnome][scarthgap][PATCH 6/7] gimp: ignore CVE-2026-2047

Quoted 20 lines · Gyorgy Sarvari via lists.openembedded.org

Details: https://nvd.nist.gov/vuln/detail/CVE-2026-2047

The vulnerability exists in ICNS importer, which was first introduced in version 3.0 [1], and the code is not present in the recipe version.

Due to this, ignore this CVE.

[1]: https://gitlab.gnome.org/GNOME/gimp/-/commit/00232e17875d4676a2c797a429db23b1a9815db8

---
 meta-gnome/recipes-gimp/gimp/gimp_2.10.38.bb | 1 +
 1 file changed, 1 insertion(+)
meta-gnome/recipes-gimp/gimp/gimp_2.10.38.bb +0 -0
index d38160a864..8b3dd4aa5f 100644

meta-gnome/recipes-gimp/gimp/gimp_2.10.38.bb CVE_STATUS[CVE-2007-3741] = "not-applicable-platform: This only applies for Mand · line 89

Quoted 4 lines
meta-gnome/recipes-gimp/gimp/gimp_2.10.38.bb +1 -0
@@ -86,3 +86,4 @@ CVE_STATUS[CVE-2007-3741] = "not-applicable-platform: This only applies for Mand
 CVE_STATUS[CVE-2025-48796] = "cpe-incorrect: The current version (2.10.38) is not affected."
 CVE_STATUS[CVE-2025-14423] = "cpe-incorrect: The vulnerability was introduced in v3.0"
 CVE_STATUS[CVE-2025-14424] = "cpe-incorrect: The vulnerability was introduced in v3.0"
+CVE_STATUS[CVE-2025-2047] = "cpe-incorrect: The vulnerability was introduced in v3.0"

You probably meant CVE-2026-2047 here? I have fixed it in my branch. Please let me know if that is not correct.

Thanks,

Anuj

#7 lore raw

Re: [oe] [meta-gnome][scarthgap][PATCH 6/7] gimp: ignore CVE-2026-2047

Quoted 18 lines · Anuj Mittal
Quoted 15 lines · Gyorgy Sarvari via lists.openembedded.org

Details: https://nvd.nist.gov/vuln/detail/CVE-2026-2047

The vulnerability exists in ICNS importer, which was first introduced in version 3.0 [1], and the code is not present in the recipe version.

Due to this, ignore this CVE.

[1]: https://gitlab.gnome.org/GNOME/gimp/-/commit/00232e17875d4676a2c797a429db23b1a9815db8

---
 meta-gnome/recipes-gimp/gimp/gimp_2.10.38.bb | 1 +
 1 file changed, 1 insertion(+)
Quoted 11 lines

meta-gnome/recipes-gimp/gimp/gimp_2.10.38.bb CVE_STATUS[CVE-2007-3741] = "not-applicable-platform: This only applies for Mand · line 89

Quoted 9 lines
meta-gnome/recipes-gimp/gimp/gimp_2.10.38.bb +1 -0
index d38160a864..8b3dd4aa5f 100644
@@ -86,3 +86,4 @@ CVE_STATUS[CVE-2007-3741] = "not-applicable-platform: This only applies for Mand
 CVE_STATUS[CVE-2025-48796] = "cpe-incorrect: The current version (2.10.38) is not affected."
 CVE_STATUS[CVE-2025-14423] = "cpe-incorrect: The vulnerability was introduced in v3.0"
 CVE_STATUS[CVE-2025-14424] = "cpe-incorrect: The vulnerability was introduced in v3.0"
+CVE_STATUS[CVE-2025-2047] = "cpe-incorrect: The vulnerability was introduced in v3.0"

You probably meant CVE-2026-2047 here? I have fixed it in my branch.

Yeah, that's a typo, thanks for fixing it.

#8 lore raw

PATCH 7/7 gimp: patch CVE-2026-2048

In reply to Gyorgy Sarvari

Details: https://nvd.nist.gov/vuln/detail/CVE-2026-2048

Pick the patch from the relevant upstream issue[1];

[1]: https://gitlab.gnome.org/GNOME/gimp/-/issues/15554

---
 .../gimp/gimp/CVE-2026-2048.patch             | 84 +++++++++++++++++++
 meta-gnome/recipes-gimp/gimp/gimp_2.10.38.bb  |  1 +
 2 files changed, 85 insertions(+)
 create mode 100644 meta-gnome/recipes-gimp/gimp/gimp/CVE-2026-2048.patch
meta-gnome/recipes-gimp/gimp/gimp/CVE-2026-2048.patch new file +84 -0
new file mode 100644
index 0000000000..e0d506b0c3
@@ -0,0 +1,84 @@
+From f8c00176788240744218e43664cba1cec4092822 Mon Sep 17 00:00:00 2001
+From: Alx Sa <[email protected]>
+Date: Wed, 31 Dec 2025 14:45:15 +0000
+Subject: [PATCH] plug-ins: Add OoB check for loading XWD
+
+Resolves #15554
+This patch adds a check for if our pointer arithmetic
+exceeds the memory allocated for the dest array. If so,
+we throw an error rather than access memory outside
+the bounds.
+
+CVE: CVE-2026-2048
+Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/gimp/-/commit/57712677007793118388c5be6fb8231f22a2b341]
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ plug-ins/common/file-xwd.c | 27 +++++++++++++++++++++++++--
+ 1 file changed, 25 insertions(+), 2 deletions(-)
+
+diff --git a/plug-ins/common/file-xwd.c b/plug-ins/common/file-xwd.c
+index 8ab11c0..c84d70e 100644
+--- a/plug-ins/common/file-xwd.c
++++ b/plug-ins/common/file-xwd.c
+@@ -2103,6 +2103,7 @@ load_xwd_f1_d24_b1 (const gchar      *filename,
+   gulong           redmask, greenmask, bluemask;
+   guint            redshift, greenshift, blueshift;
+   gulong           g;
++  guint32          maxval;
+   guchar           redmap[256], greenmap[256], bluemap[256];
+   guchar           bit_reverse[256];
+   guchar          *xwddata, *xwdin, *data;
+@@ -2194,6 +2195,7 @@ load_xwd_f1_d24_b1 (const gchar      *filename,
+ 
+   tile_height = gimp_tile_height ();
+   data = g_malloc (tile_height * width * bytes_per_pixel);
++  maxval = tile_height * width * bytes_per_pixel;
+ 
+   ncols = xwdhdr->l_colormap_entries;
+   if (xwdhdr->l_ncolors < ncols)
+@@ -2218,6 +2220,8 @@ load_xwd_f1_d24_b1 (const gchar      *filename,
+ 
+   for (tile_start = 0; tile_start < height; tile_start += tile_height)
+     {
++      guint current_dest = 0;
++
+       memset (data, 0, width*tile_height*bytes_per_pixel);
+ 
+       tile_end = tile_start + tile_height - 1;
+@@ -2241,7 +2245,16 @@ load_xwd_f1_d24_b1 (const gchar      *filename,
+           else           /* 3 bytes per pixel */
+             {
+               fromright = xwdhdr->l_pixmap_depth-1-plane;
+-              dest += 2 - fromright/8;
++              current_dest += 2 - fromright / 8;
++              if (current_dest < maxval)
++                {
++                  dest += 2 - fromright / 8;
++                }
++              else
++                {
++                  err = 1;
++                  break;
++                }
+               outmask = (1 << (fromright % 8));
+             }
+ 
+@@ -2296,7 +2309,17 @@ load_xwd_f1_d24_b1 (const gchar      *filename,
+ 
+                   if (g & inmask)
+                     *dest |= outmask;
+-                  dest += bytes_per_pixel;
++
++                  current_dest += bytes_per_pixel;
++                  if (current_dest < maxval)
++                    {
++                      dest += bytes_per_pixel;
++                    }
++                  else
++                    {
++                      err = 1;
++                      break;
++                    }
+ 
+                   inmask >>= 1;
+                 }
meta-gnome/recipes-gimp/gimp/gimp_2.10.38.bb +1 -0
index 8b3dd4aa5f..4e0dd76744 100644
@@ -57,6 +57,7 @@ SRC_URI = "https://download.gimp.org/pub/${BPN}/v${SHPV}/${BP}.tar.bz2 \
            file://CVE-2026-0797.patch \
            file://CVE-2026-2044.patch \
            file://CVE-2026-2045.patch \
+           file://CVE-2026-2048.patch \
            "
 SRC_URI[sha256sum] = "50a845eec11c8831fe8661707950f5b8446e35f30edfb9acf98f85c1133f856e"