File gimp-CVE-2023-44443-44444.patch of Package gimp.31720

--- gimp-2.10.30.orig/plug-ins/common/file-psp.c	2023-11-17 19:46:12.769508292 +0530
+++ gimp-2.10.30/plug-ins/common/file-psp.c	2023-11-17 21:33:59.798169716 +0530
@@ -1128,6 +1128,14 @@ read_color_block (FILE      *f,
     }
 
   color_palette_entries = GUINT32_FROM_LE (entry_count);
+  /* TODO: GIMP currently only supports a maximum of 256 colors
+   * in an indexed image. If this changes, we can change this check */
+  if (color_palette_entries > 256)
+    {
+      g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
+                   _("Error: Unsupported palette size"));
+      return -1;
+    }
   /* psp color palette entries are stored as RGBA so 4 bytes per entry
      where the fourth bytes is always zero */
   pal_size = color_palette_entries * 4;
@@ -1498,7 +1506,7 @@ read_channel_data (FILE        *f,
         else
           endq = q + line_width * height;
 
-        buf = g_malloc (127);
+        buf = g_malloc (128);
         while (q < endq)
           {
             fread (&runcount, 1, 1, f);
openSUSE Build Service is sponsored by