Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] GIMP: applying gtk patch to stop crash when using with wacom tablet
@ 2023-11-01 21:02 gc-user
  2023-11-01 21:07 ` oreo639
                   ` (23 more replies)
  0 siblings, 24 replies; 25+ messages in thread
From: gc-user @ 2023-11-01 21:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 721 bytes --]

There is a new pull request by gc-user against master on the void-packages repository

https://github.com/gc-user/void-packages master
https://github.com/void-linux/void-packages/pull/47014

GIMP: applying gtk patch to stop crash when using with wacom tablet
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
YES

GIMP (with combination xf86-input-wacom v1.2.0_1) doesn't crash anymore when performing actions that make it reliably crash with GIMP v2.10.34_2.

#### Local build testing
- I built this PR locally for my native architecture, (x86_64, glibc 2.36_2)


A patch file from https://github.com/void-linux/void-packages/pull/47014.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-47014.patch --]
[-- Type: text/x-diff, Size: 3442 bytes --]

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 922bc2d5e919eb76733bd2eeb78b6033400c97b0 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;

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2024-02-04  8:08 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-01 21:02 [PR PATCH] GIMP: applying gtk patch to stop crash when using with wacom tablet gc-user
2023-11-01 21:07 ` oreo639
2023-11-01 21:09 ` oreo639
2023-11-01 21:09 ` oreo639
2023-11-01 21:12 ` oreo639
2023-11-01 21:13 ` oreo639
2023-11-01 21:14 ` oreo639
2023-11-01 21:14 ` gc-user
2023-11-01 21:16 ` oreo639
2023-11-02 13:04 ` [PR PATCH] [Updated] gimp: " gc-user
2023-11-02 13:15 ` gc-user
2023-11-02 13:18 ` gc-user
2023-11-02 13:21 ` gc-user
2023-11-02 13:24 ` gc-user
2023-11-02 16:51 ` [PR REVIEW] " paper42
2023-11-02 17:00 ` gc-user
2023-11-02 19:28 ` oreo639
2023-11-02 19:28 ` oreo639
2023-11-02 19:30 ` biopsin
2023-11-02 19:51 ` [PR PATCH] [Updated] " gc-user
2023-11-02 20:17 ` gc-user
2023-11-02 20:21 ` [PR REVIEW] " gc-user
2024-02-01  1:45 ` github-actions
2024-02-04  8:08 ` [PR PATCH] [Closed]: " oreo639
2024-02-04  8:08 ` oreo639

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).