File gimp-CVE_2022-30067.patch of Package gimp.38644
From 8cd6d05232795ac31076013db1c6be3dc67e8e09 Mon Sep 17 00:00:00 2001
From: Jacob Boerema <jgboerema@gmail.com>
Date: Fri, 29 Apr 2022 16:40:32 -0400
Subject: [PATCH] app: fix #8120 GIMP 2.10.30 crashed when allocate large
memory
GIMP could crash if the information regarding old path properties read
from XCF was incorrect. It did not check if xcf_old_path succeeded and
kept trying to load more paths even if the last one failed to load.
Instead we now stop loading paths as soon as that function fails.
In case we have a failure here we also try to skip to the next property
based on the size of the path property, in hopes that the only problem
was this property.
Backported by Mike Gorse <mgorse@suse.com>
---
diff -urp gimp-2.8.18.orig/app/xcf/xcf-load.c gimp-2.8.18/app/xcf/xcf-load.c
--- gimp-2.8.18.orig/app/xcf/xcf-load.c 2016-07-04 13:35:15.000000000 -0500
+++ gimp-2.8.18/app/xcf/xcf-load.c 2022-05-18 15:08:34.421821807 -0500
@@ -657,7 +657,12 @@ xcf_load_image_props (XcfInfo *info,
break;
case PROP_PATHS:
- xcf_load_old_paths (info, image);
+ {
+ goffset base = info->cp;
+
+ if (! xcf_load_old_paths (info, image))
+ xcf_seek_pos (info, base + prop_size, NULL);
+ }
break;
case PROP_USER_UNIT:
@@ -1766,7 +1771,8 @@ xcf_load_old_paths (XcfInfo *info,
info->cp += xcf_read_int32 (info->fp, &num_paths, 1);
while (num_paths-- > 0)
- xcf_load_old_path (info, image);
+ if (! xcf_load_old_path (info, image))
+ return FALSE;
active_vectors =
GIMP_VECTORS (gimp_container_get_child_by_index (gimp_image_get_vectors (image),
@@ -1817,7 +1823,7 @@ xcf_load_old_path (XcfInfo *info,
}
else if (version != 1)
{
- g_warning ("Unknown path type. Possibly corrupt XCF file");
+ g_warning ("Unknown path type (version: %u). Possibly corrupt XCF file", version);
return FALSE;
}