From: gc-user <gc-user@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] gimp: applying gtk patch to stop crash when using with wacom tablet
Date: Thu, 02 Nov 2023 20:51:40 +0100 [thread overview]
Message-ID: <20231102195140.c9zsZL9UFmDt8xxtLUOJ1kKfC34Zr5Avf3-6BYcRP4Q@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-47014@inbox.vuxu.org>
[-- Attachment #1: Type: text/plain, Size: 729 bytes --]
There is an updated 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 (in combination with 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: 4820 bytes --]
From b4ae183b7111fa153640d0eb9c117963ec51440b 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/patches/gtk-workaround.patch | 40 +++++++++++++++++++++++
srcpkgs/gimp/template | 2 +-
2 files changed, 41 insertions(+), 1 deletion(-)
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;
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 6aa1514f88f3e106d71cb9af547281e1835b199e Mon Sep 17 00:00:00 2001
From: gc-user <37037831+gc-user@users.noreply.github.com>
Date: Thu, 2 Nov 2023 20:51:36 +0100
Subject: [PATCH 2/2] Update gtk-workaround.patch
Put additional info about the patch back in.
---
srcpkgs/gimp/patches/gtk-workaround.patch | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/srcpkgs/gimp/patches/gtk-workaround.patch b/srcpkgs/gimp/patches/gtk-workaround.patch
index c78b63ad56033..b89ab6480fad6 100644
--- a/srcpkgs/gimp/patches/gtk-workaround.patch
+++ b/srcpkgs/gimp/patches/gtk-workaround.patch
@@ -1,3 +1,23 @@
+Source: https://gitlab.gnome.org/GNOME/gimp/-/merge_requests/935.patch
+
+From 4c54950219fc1dcebafd734645ec3b9d31c7fe64 Mon Sep 17 00:00:00 2001
+From: Gabriel Scherer <gabriel.scherer@gmail.com>
+Date: Thu, 1 Jun 2023 16:23:22 +0200
+Subject: [PATCH] a workaround fix for a gdk_device_get_state bug
+
+See https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6045
+
+This is an alternative, quick&dirty approach to the nicer but more
+invasive workaround:
+ https://gitlab.gnome.org/GNOME/gimp/-/merge_requests/934
+
+Suggested-by: Peter Hutterer <peter.hutterer@who-t.net>
+---
+ app/widgets/gimpdeviceinfo-coords.c | 27 ++++++++++++++++++++++++++-
+ 1 file changed, 26 insertions(+), 1 deletion(-)
+
+diff --git a/app/widgets/gimpdeviceinfo-coords.c b/app/widgets/gimpdeviceinfo-coords.c
+index 93c1d90beae..024cd5b1b4d 100644
--- a/app/widgets/gimpdeviceinfo-coords.c
+++ b/app/widgets/gimpdeviceinfo-coords.c
@@ -121,12 +121,37 @@ gimp_device_info_get_event_coords (GimpDeviceInfo *info,
@@ -38,3 +58,6 @@
+ gdouble axes[GIMP_AXIS_HOPEFULLY_LAST] = { 0, };
*coords = default_coords;
+
+--
+GitLab
next prev parent reply other threads:[~2023-11-02 19:51 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-01 21:02 [PR PATCH] GIMP: " 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 ` gc-user [this message]
2023-11-02 20:17 ` [PR PATCH] [Updated] " 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231102195140.c9zsZL9UFmDt8xxtLUOJ1kKfC34Zr5Avf3-6BYcRP4Q@z \
--to=gc-user@users.noreply.github.com \
--cc=ml@inbox.vuxu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).