gimp: patch CVE-2022-30067
PATCH 1/2 gimp: patch CVE-2022-30067
Details: https://nvd.nist.gov/vuln/detail/CVE-2022-30067
Pick patch that resolved the issue mentioned in the nvd report.
Signed-off-by Gyorgy Sarvari <[email protected]>
--- .../gimp/gimp/CVE-2022-30067.patch | 64 +++++++++++++++++++ meta-gnome/recipes-gimp/gimp/gimp_2.10.30.bb | 4 +- 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 meta-gnome/recipes-gimp/gimp/gimp/CVE-2022-30067.patch
meta-gnome/recipes-gimp/gimp/gimp/CVE-2022-30067.patch new file +64 -0
@@ -0,0 +1,64 @@ +From ba698607ab24905d5e7fca24c11f6413c886a2a2 Mon Sep 17 00:00:00 2001 +From: Jacob Boerema <[email protected]> +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. + +(cherry picked from commit 4f99f1fcfd892ead19831b5adcd38a99d71214b6) + +CVE: CVE-2022-30067 +Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/gimp/-/commit/8cd6d05232795ac31076013db1c6be3dc67e8e09] +Signed-off-by: Gyorgy Sarvari <[email protected]> +--- + app/xcf/xcf-load.c | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c +index fe28d28..a178e40 100644 +--- a/app/xcf/xcf-load.c ++++ b/app/xcf/xcf-load.c +@@ -1052,7 +1052,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: +@@ -2720,8 +2725,11 @@ xcf_load_old_paths (XcfInfo *info, + xcf_read_int32 (info, &last_selected_row, 1); + xcf_read_int32 (info, &num_paths, 1); + ++ GIMP_LOG (XCF, "Number of old paths: %u", num_paths); ++ + 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), +@@ -2772,7 +2780,7 @@ xcf_load_old_path (XcfInfo *info, + } + else if (version != 1) + { +- g_printerr ("Unknown path type. Possibly corrupt XCF file"); ++ g_printerr ("Unknown path type (version: %u). Possibly corrupt XCF file.\n", version); + + return FALSE; + }
meta-gnome/recipes-gimp/gimp/gimp_2.10.30.bb +3 -1
@@ -43,7 +43,9 @@ REQUIRED_DISTRO_FEATURES = "x11" SHPV = "${@gnome_verdir("${PV}")}" -SRC_URI = "https://download.gimp.org/pub/${BPN}/v${SHPV}/${BP}.tar.bz2" +SRC_URI = "https://download.gimp.org/pub/${BPN}/v${SHPV}/${BP}.tar.bz2 \ + file://CVE-2022-30067.patch \ + " SRC_URI[sha256sum] = "88815daa76ed7d4277eeb353358bafa116cd2fcd2c861d95b95135c1d52b67dc" EXTRA_OECONF = "--disable-python \
PATCH 2/2 gimp: patch CVE-2022-32990
Details: https://nvd.nist.gov/vuln/detail/CVE-2022-32990
Pick the patches that resolved the issue mentioned in the nvd report.
Signed-off-by Gyorgy Sarvari <[email protected]>
--- .../gimp/gimp/CVE-2022-32990-1.patch | 97 ++++++++++ .../gimp/gimp/CVE-2022-32990-2.patch | 178 ++++++++++++++++++ .../gimp/gimp/CVE-2022-32990-3.patch | 35 ++++ meta-gnome/recipes-gimp/gimp/gimp_2.10.30.bb | 3 + 4 files changed, 313 insertions(+) create mode 100644 meta-gnome/recipes-gimp/gimp/gimp/CVE-2022-32990-1.patch create mode 100644 meta-gnome/recipes-gimp/gimp/gimp/CVE-2022-32990-2.patch create mode 100644 meta-gnome/recipes-gimp/gimp/gimp/CVE-2022-32990-3.patch
meta-gnome/recipes-gimp/gimp/gimp/CVE-2022-32990-1.patch new file +97 -0
@@ -0,0 +1,97 @@ +From 74426d562c0a36287d6ef86bf9caf29022edf0a3 Mon Sep 17 00:00:00 2001 +From: Jacob Boerema <[email protected]> +Date: Sun, 5 Jun 2022 16:48:10 -0400 +Subject: [PATCH] app: check max dimensions when loading xcf files + +Improvements in loading broken xcf files, based on examining issue #8230. +Besides checking for a minimum width and height, GIMP also has a maximum +size we can and should check. + +In the case of the image itself, we change invalid dimensions to a size of +1 in hope that the individual layers etc will have the correct size. +For layer, we will also try to go on, but for channel and layer mask, we +will give up. + +(cherry picked from commit 24c962b95e5c740dff7a87a1f0ccdbf6c0a8c21e) + +CVE: CVE-2022-32990 +Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/gimp/-/commit/e7d4b580e514029f28dc9bd59c66187e166db47c] +Signed-off-by: Gyorgy Sarvari +--- + app/xcf/xcf-load.c | 36 +++++++++++++++++++++++++++++------- + 1 file changed, 29 insertions(+), 7 deletions(-) + +diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c +index a178e40..a01cf41 100644 +--- a/app/xcf/xcf-load.c ++++ b/app/xcf/xcf-load.c +@@ -183,10 +183,19 @@ xcf_load_image (Gimp *gimp, + xcf_read_int32 (info, (guint32 *) &width, 1); + xcf_read_int32 (info, (guint32 *) &height, 1); + xcf_read_int32 (info, (guint32 *) &image_type, 1); +- if (image_type < GIMP_RGB || image_type > GIMP_INDEXED || +- width <= 0 || height <= 0) ++ if (image_type < GIMP_RGB || image_type > GIMP_INDEXED) + goto hard_error; + ++ /* Be lenient with corrupt image dimensions. ++ * Hopefully layer dimensions will be valid. */ ++ if (width <= 0 || height <= 0 || ++ width > GIMP_MAX_IMAGE_SIZE || height > GIMP_MAX_IMAGE_SIZE) ++ { ++ GIMP_LOG (XCF, "Invalid image size %d x %d, setting to 1x1.", width, height); ++ width = 1; ++ height = 1; ++ } ++ + if (info->file_version >= 4) + { + gint p; +@@ -1923,7 +1932,8 @@ xcf_load_layer (XcfInfo *info, + return NULL; + } + +- if (width <= 0 || height <= 0) ++ if (width <= 0 || height <= 0 || ++ width > GIMP_MAX_IMAGE_SIZE || height > GIMP_MAX_IMAGE_SIZE) + { + gboolean is_group_layer = FALSE; + gboolean is_text_layer = FALSE; +@@ -2085,10 +2095,16 @@ xcf_load_channel (XcfInfo *info, + /* read in the layer width, height and name */ + xcf_read_int32 (info, (guint32 *) &width, 1); + xcf_read_int32 (info, (guint32 *) &height, 1); +- if (width <= 0 || height <= 0) +- return NULL; ++ if (width <= 0 || height <= 0 || ++ width > GIMP_MAX_IMAGE_SIZE || height > GIMP_MAX_IMAGE_SIZE) ++ { ++ GIMP_LOG (XCF, "Invalid channel size %d x %d.", width, height); ++ return NULL; ++ } + + xcf_read_string (info, &name, 1); ++ GIMP_LOG (XCF, "Channel width=%d, height=%d, name='%s'", ++ width, height, name); + + /* create a new channel */ + channel = gimp_channel_new (image, width, height, name, &color); +@@ -2157,10 +2173,16 @@ xcf_load_layer_mask (XcfInfo *info, + /* read in the layer width, height and name */ + xcf_read_int32 (info, (guint32 *) &width, 1); + xcf_read_int32 (info, (guint32 *) &height, 1); +- if (width <= 0 || height <= 0) +- return NULL; ++ if (width <= 0 || height <= 0 || ++ width > GIMP_MAX_IMAGE_SIZE || height > GIMP_MAX_IMAGE_SIZE) ++ { ++ GIMP_LOG (XCF, "Invalid layer mask size %d x %d.", width, height); ++ return NULL; ++ } + + xcf_read_string (info, &name, 1); ++ GIMP_LOG (XCF, "Layer mask width=%d, height=%d, name='%s'", ++ width, height, name); + + /* create a new layer mask */ + layer_mask = gimp_layer_mask_new (image, width, height, name, &color);
meta-gnome/recipes-gimp/gimp/gimp/CVE-2022-32990-2.patch new file +178 -0
178 lines not on this page · raw message
meta-gnome/recipes-gimp/gimp/gimp/CVE-2022-32990-3.patch new file +35 -0
@@ -0,0 +1,35 @@ +From 81860b9a56d83f429824aa0073c2152b49f9d332 Mon Sep 17 00:00:00 2001 +From: Jacob Boerema <[email protected]> +Date: Sun, 5 Jun 2022 15:38:24 -0400 +Subject: [PATCH] app: fix #8230 crash in gimp_layer_invalidate_boundary when + channel is NULL + +gimp_channel_is_empty returns FALSE if channel is NULL. This causes +gimp_layer_invalidate_boundary to crash if the mask channel is NULL. + +With a NULL channel gimp_channel_is_empty should return TRUE, just like +the similar gimp_image_is_empty does, because returning FALSE here +suggests we have a non empty channel. + +(cherry picked from commit 22af0bcfe67c1c86381f33975ca7fdbde6b36b39) + +CVE: CVE-2022-32990 +Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/gimp/-/commit/744959433647bdefcdf00b3f0d575f6812cd0d6d] +Signed-off-by: Gyorgy Sarvari <[email protected]> +--- + app/core/gimpchannel.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c +index a9b7546..784551a 100644 +--- a/app/core/gimpchannel.c ++++ b/app/core/gimpchannel.c +@@ -1824,7 +1824,7 @@ gimp_channel_boundary (GimpChannel *channel, + gboolean + gimp_channel_is_empty (GimpChannel *channel) + { +- g_return_val_if_fail (GIMP_IS_CHANNEL (channel), FALSE); ++ g_return_val_if_fail (GIMP_IS_CHANNEL (channel), TRUE); + + return GIMP_CHANNEL_GET_CLASS (channel)->is_empty (channel); + }
meta-gnome/recipes-gimp/gimp/gimp_2.10.30.bb +3 -0
@@ -45,6 +45,9 @@ SHPV = "${@gnome_verdir("${PV}")}" SRC_URI = "https://download.gimp.org/pub/${BPN}/v${SHPV}/${BP}.tar.bz2 \ file://CVE-2022-30067.patch \ + file://CVE-2022-32990-1.patch \ + file://CVE-2022-32990-2.patch \ + file://CVE-2022-32990-3.patch \ " SRC_URI[sha256sum] = "88815daa76ed7d4277eeb353358bafa116cd2fcd2c861d95b95135c1d52b67dc"