File: plug-ins-fix-ZDI-CAN-27823.patch

package info (click to toggle)
gimp 3.0.4-6.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 210,548 kB
  • sloc: ansic: 842,405; lisp: 10,761; python: 10,318; cpp: 7,238; perl: 4,355; sh: 1,043; xml: 963; yacc: 609; lex: 348; javascript: 150; makefile: 43
file content (50 lines) | stat: -rw-r--r-- 1,924 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
From: Jacob Boerema <jgboerema@gmail.com>
Date: Wed, 3 Sep 2025 18:37:26 -0400
Subject: plug-ins: fix ZDI-CAN-27823
Origin: https://gitlab.gnome.org/GNOME/gimp/-/commit/5c3e2122d53869599d77ef0f1bdece117b24fd7c
Bug: https://gitlab.gnome.org/GNOME/gimp/-/issues/14814
Bug-Debian: https://bugs.debian.org/1119661
Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2025-10934

GIMP XWD File Parsing Heap-based Buffer Overflow Remote Code Execution
Vulnerability.

Check offset in colormap is valid before writing to it.

Closes #14814

(cherry picked from commit 4eb106f2bff2d9b8e518aa455a884c6f38d70c6a)
---
 plug-ins/common/file-xwd.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/plug-ins/common/file-xwd.c b/plug-ins/common/file-xwd.c
index 8d013397be69..c4c41e5bea7e 100644
--- a/plug-ins/common/file-xwd.c
+++ b/plug-ins/common/file-xwd.c
@@ -1683,9 +1683,20 @@ load_xwd_f2_d16_b16 (GFile           *file,
           greenval = (green * 255) / maxgreen;
           for (blue = 0; blue <= maxblue; blue++)
             {
+              guint32 offset = ((red << redshift) + (green << greenshift) +
+                                (blue << blueshift)) * 3;
+
+              if (offset+2 >= maxval)
+                {
+                  g_set_error (error, GIMP_PLUG_IN_ERROR, 0,
+                               _("Invalid colormap offset. Possibly corrupt image."));
+                  g_free (data);
+                  g_free (ColorMap);
+                  g_object_unref (buffer);
+                  return NULL;
+                }
               blueval = (blue * 255) / maxblue;
-              cm = ColorMap + ((red << redshift) + (green << greenshift)
-                               + (blue << blueshift)) * 3;
+              cm = ColorMap + offset;
               *(cm++) = redval;
               *(cm++) = greenval;
               *cm = blueval;
-- 
2.51.0