|
 |
5463bc |
From 4f99f1fcfd892ead19831b5adcd38a99d71214b6 Mon Sep 17 00:00:00 2001
|
|
 |
5463bc |
From: Jacob Boerema <jgboerema@gmail.com>
|
|
 |
5463bc |
Date: Fri, 29 Apr 2022 16:40:32 -0400
|
|
 |
5463bc |
Subject: [PATCH] app: fix #8120 GIMP 2.10.30 crashed when allocate large
|
|
 |
5463bc |
memory
|
|
 |
5463bc |
|
|
 |
5463bc |
GIMP could crash if the information regarding old path properties read
|
|
 |
5463bc |
from XCF was incorrect. It did not check if xcf_old_path succeeded and
|
|
 |
5463bc |
kept trying to load more paths even if the last one failed to load.
|
|
 |
5463bc |
|
|
 |
5463bc |
Instead we now stop loading paths as soon as that function fails.
|
|
 |
5463bc |
In case we have a failure here we also try to skip to the next property
|
|
 |
5463bc |
based on the size of the path property, in hopes that the only problem
|
|
 |
5463bc |
was this property.
|
|
 |
5463bc |
---
|
|
 |
5463bc |
app/xcf/xcf-load.c | 14 +++++++++++---
|
|
 |
5463bc |
1 file changed, 11 insertions(+), 3 deletions(-)
|
|
 |
5463bc |
|
|
 |
5463bc |
diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c
|
|
 |
5463bc |
index ac9c4ea248..67bc766390 100644
|
|
 |
5463bc |
--- a/app/xcf/xcf-load.c
|
|
 |
5463bc |
+++ b/app/xcf/xcf-load.c
|
|
 |
5463bc |
@@ -1168,7 +1168,12 @@ xcf_load_image_props (XcfInfo *info,
|
|
 |
5463bc |
break;
|
|
 |
5463bc |
|
|
 |
5463bc |
case PROP_PATHS:
|
|
 |
5463bc |
- xcf_load_old_paths (info, image);
|
|
 |
5463bc |
+ {
|
|
 |
5463bc |
+ goffset base = info->cp;
|
|
 |
5463bc |
+
|
|
 |
5463bc |
+ if (! xcf_load_old_paths (info, image))
|
|
 |
5463bc |
+ xcf_seek_pos (info, base + prop_size, NULL);
|
|
 |
5463bc |
+ }
|
|
 |
5463bc |
break;
|
|
 |
5463bc |
|
|
 |
5463bc |
case PROP_USER_UNIT:
|
|
 |
5463bc |
@@ -3035,8 +3040,11 @@ xcf_load_old_paths (XcfInfo *info,
|
|
 |
5463bc |
xcf_read_int32 (info, &last_selected_row, 1);
|
|
 |
5463bc |
xcf_read_int32 (info, &num_paths, 1);
|
|
 |
5463bc |
|
|
 |
5463bc |
+ GIMP_LOG (XCF, "Number of old paths: %u", num_paths);
|
|
 |
5463bc |
+
|
|
 |
5463bc |
while (num_paths-- > 0)
|
|
 |
5463bc |
- xcf_load_old_path (info, image);
|
|
 |
5463bc |
+ if (! xcf_load_old_path (info, image))
|
|
 |
5463bc |
+ return FALSE;
|
|
 |
5463bc |
|
|
 |
5463bc |
active_vectors =
|
|
 |
5463bc |
GIMP_VECTORS (gimp_container_get_child_by_index (gimp_image_get_vectors (image),
|
|
 |
5463bc |
@@ -3087,7 +3095,7 @@ xcf_load_old_path (XcfInfo *info,
|
|
 |
5463bc |
}
|
|
 |
5463bc |
else if (version != 1)
|
|
 |
5463bc |
{
|
|
 |
5463bc |
- g_printerr ("Unknown path type. Possibly corrupt XCF file");
|
|
 |
5463bc |
+ g_printerr ("Unknown path type (version: %u). Possibly corrupt XCF file.\n", version);
|
|
 |
5463bc |
|
|
 |
5463bc |
g_free (name);
|
|
 |
5463bc |
return FALSE;
|
|
 |
5463bc |
--
|
|
 |
5463bc |
GitLab
|