From 11a2c55d1f40ba4ed6d0b9c530f71a5d8939d3eb Mon Sep 17 00:00:00 2001 From: gc-user <37037831+gc-user@users.noreply.github.com> Date: Wed, 1 Nov 2023 21:43:22 +0100 Subject: [PATCH 1/2] GIMP: applying gtk patch to stop crash when using with wacom tablet See discussion of the problem: https://github.com/void-linux/void-packages/issues/46975 See patch that was applied: https://gitlab.gnome.org/GNOME/gimp/-/merge_requests/935.patch --- srcpkgs/gimp/template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srcpkgs/gimp/template b/srcpkgs/gimp/template index cdaa6ded089bb..d9008e8e1d294 100644 --- a/srcpkgs/gimp/template +++ b/srcpkgs/gimp/template @@ -1,7 +1,7 @@ # Template file for 'gimp' pkgname=gimp version=2.10.34 -revision=2 +revision=3 build_style=gnu-configure configure_args="--disable-check-update --datadir=/usr/share --disable-python" hostmakedepends="automake gegl gettext-devel glib-devel gtk+-devel intltool From 3cd7a68bf79471ccb518c6ae255195a3184f90be Mon Sep 17 00:00:00 2001 From: gc-user <37037831+gc-user@users.noreply.github.com> Date: Wed, 1 Nov 2023 21:46:11 +0100 Subject: [PATCH 2/2] gimp: adding gtk patch See discussion of the problem: void-linux#46975 See patch that was applied: https://gitlab.gnome.org/GNOME/gimp/-/merge_requests/935.patch --- srcpkgs/gimp/patches/gtk-workaround.patch | 40 +++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 srcpkgs/gimp/patches/gtk-workaround.patch diff --git a/srcpkgs/gimp/patches/gtk-workaround.patch b/srcpkgs/gimp/patches/gtk-workaround.patch new file mode 100644 index 0000000000000..c78b63ad56033 --- /dev/null +++ b/srcpkgs/gimp/patches/gtk-workaround.patch @@ -0,0 +1,40 @@ +--- a/app/widgets/gimpdeviceinfo-coords.c ++++ b/app/widgets/gimpdeviceinfo-coords.c +@@ -121,12 +121,37 @@ gimp_device_info_get_event_coords (GimpDeviceInfo *info, + return FALSE; + } + ++#define GIMP_AXIS_HOPEFULLY_LAST 36 ++/* gtk2 has a bug where gdk_device_get_state may write ++ more coordinates than GDK_AXIS_LAST in a caller-provided ++ array, resulting in a buffer overflow. ++ ++ This happens when the underlying X device supports more axes -- as ++ of 2023, the Wacom tablet driver 1.20 supports 8 axes when ++ GDK_AXIS_LAST is 7. ++ ++ To be safe we over-estimate the maximum number of axes that any ++ driver may provide to gtk, to avoid buffer overflows. It would be nicer ++ to fix gdk upstream (to never write more than GDK_AXIS_LAST - GDK_AXIS_X ++ coordinates), but the proper upstream fix was rejected as gtk2 is EOL: ++ https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6045 ++ ++ Our constant might in theory become wrong if new device drivers ++ start returning much more axes than they do today -- more than 32, ++ when the current maximum is 8. Hopefully, by the time this happens, ++ users have migrated to gtk3 versions of gimp that use a different ++ API and do not suffer from this bug. ++ ++ We chose 36 as it is also the internal limit MAX_VALUATORS on the ++ number of 'valuators' used by current X server implementations. ++*/ ++ + void + gimp_device_info_get_device_coords (GimpDeviceInfo *info, + GdkWindow *window, + GimpCoords *coords) + { +- gdouble axes[GDK_AXIS_LAST] = { 0, }; ++ gdouble axes[GIMP_AXIS_HOPEFULLY_LAST] = { 0, }; + + *coords = default_coords;