commit: 700385f127e76361a98b54f4f8e23583e11f7b8a Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Mon Aug 11 08:25:25 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Mon Aug 11 08:37:12 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=700385f1
app-crypt/gpa: fix UB causing crashes; fix build w/ gpgme-2 Closes: https://bugs.gentoo.org/957196 Closes: https://bugs.gentoo.org/961312 Signed-off-by: Sam James <sam <AT> gentoo.org> ...plicit-declaration-of-gpa_keytable_ensure.patch | 20 +++++ ...t_item-stuff-to-make-it-build-with-gpgme-.patch | 97 ++++++++++++++++++++++ .../0003-Fix-incorrect-callback-arguments.patch | 69 +++++++++++++++ app-crypt/gpa/files/gpa-0.11.0-c99.patch | 17 ---- .../{gpa-0.11.0.ebuild => gpa-0.11.0-r1.ebuild} | 3 +- 5 files changed, 188 insertions(+), 18 deletions(-) diff --git a/app-crypt/gpa/files/0.11.0/0001-Fix-implicit-declaration-of-gpa_keytable_ensure.patch b/app-crypt/gpa/files/0.11.0/0001-Fix-implicit-declaration-of-gpa_keytable_ensure.patch new file mode 100644 index 000000000000..279632956c8b --- /dev/null +++ b/app-crypt/gpa/files/0.11.0/0001-Fix-implicit-declaration-of-gpa_keytable_ensure.patch @@ -0,0 +1,20 @@ +From aa63712b18b79b983e3d9cd7ce5105d0ec7ac262 Mon Sep 17 00:00:00 2001 +Message-ID: <aa63712b18b79b983e3d9cd7ce5105d0ec7ac262.1754900600.git....@gentoo.org> +From: Andreas Stieger <[email protected]> +Date: Fri, 18 Jul 2025 09:39:50 +0200 +Subject: [PATCH 1/3] Fix implicit declaration of gpa_keytable_ensure + +* src/cm-piv.c: Fix implicit declaration of gpa_keytable_ensure. +--- a/src/cm-piv.c ++++ b/src/cm-piv.c +@@ -41,6 +41,7 @@ + #include "gtktools.h" + #include "convert.h" + #include "gpa-key-details.h" ++#include "keytable.h" + + #include "cm-object.h" + #include "cm-piv.h" +-- +2.50.1 + diff --git a/app-crypt/gpa/files/0.11.0/0002-Remove-trust_item-stuff-to-make-it-build-with-gpgme-.patch b/app-crypt/gpa/files/0.11.0/0002-Remove-trust_item-stuff-to-make-it-build-with-gpgme-.patch new file mode 100644 index 000000000000..b5cf7e1b849c --- /dev/null +++ b/app-crypt/gpa/files/0.11.0/0002-Remove-trust_item-stuff-to-make-it-build-with-gpgme-.patch @@ -0,0 +1,97 @@ +From b6ba8bcc6db7765667cd6c49b7edc9a2073bc74f Mon Sep 17 00:00:00 2001 +Message-ID: <b6ba8bcc6db7765667cd6c49b7edc9a2073bc74f.1754900600.git....@gentoo.org> +In-Reply-To: <aa63712b18b79b983e3d9cd7ce5105d0ec7ac262.1754900600.git....@gentoo.org> +References: <aa63712b18b79b983e3d9cd7ce5105d0ec7ac262.1754900600.git....@gentoo.org> +From: Werner Koch <[email protected]> +Date: Fri, 18 Jul 2025 09:45:23 +0200 +Subject: [PATCH 2/3] Remove trust_item stuff to make it build with gpgme 2.x + +* src/gpacontext.h (struct _GpaContextClass): Remove next_trust_item. +* src/gpacontext.c (NEXT_TRUST_ITEM): Remove +(gpa_context_class_init): Remove assignment. +(gpa_context_event_cb): Remove handler. +(gpa_context_next_trust_item): Remove. +-- + +Note that the trust item feature worked only for a very short period +in 2003. +--- a/src/gpacontext.c ++++ b/src/gpacontext.c +@@ -38,8 +38,6 @@ static void gpa_context_finalize (GObject *object); + static void gpa_context_start (GpaContext *context); + static void gpa_context_done (GpaContext *context, gpg_error_t err); + static void gpa_context_next_key (GpaContext *context, gpgme_key_t key); +-static void gpa_context_next_trust_item (GpaContext *context, +- gpgme_trust_item_t item); + static void gpa_context_progress (GpaContext *context, int current, int total); + + /* The GPGME I/O callbacks */ +@@ -65,7 +63,6 @@ enum + START, + DONE, + NEXT_KEY, +- NEXT_TRUST_ITEM, + PROGRESS, + LAST_SIGNAL + }; +@@ -113,7 +110,6 @@ gpa_context_class_init (GpaContextClass *klass) + klass->start = gpa_context_start; + klass->done = gpa_context_done; + klass->next_key = gpa_context_next_key; +- klass->next_trust_item = gpa_context_next_trust_item; + klass->progress = gpa_context_progress; + + /* Signals */ +@@ -143,15 +139,6 @@ gpa_context_class_init (GpaContextClass *klass) + g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, 1, + G_TYPE_POINTER); +- signals[NEXT_TRUST_ITEM] = +- g_signal_new ("next_trust_item", +- G_TYPE_FROM_CLASS (object_class), +- G_SIGNAL_RUN_FIRST, +- G_STRUCT_OFFSET (GpaContextClass, next_trust_item), +- NULL, NULL, +- g_cclosure_marshal_VOID__POINTER, +- G_TYPE_NONE, 1, +- G_TYPE_POINTER); + signals[PROGRESS] = + g_signal_new ("progress", + G_TYPE_FROM_CLASS (object_class), +@@ -496,10 +483,6 @@ gpa_context_event_cb (void *data, gpgme_event_io_t type, void *type_data) + case GPGME_EVENT_NEXT_KEY: + g_signal_emit (context, signals[NEXT_KEY], 0, type_data); + break; +- case GPGME_EVENT_NEXT_TRUSTITEM: +- g_signal_emit (context, signals[NEXT_TRUST_ITEM], 0, +- type_data); +- break; + default: + /* Ignore unsupported event types */ + break; +@@ -531,12 +514,6 @@ gpa_context_next_key (GpaContext *context, gpgme_key_t key) + /* Do nothing yet */ + } + +-static void +-gpa_context_next_trust_item (GpaContext *context, gpgme_trust_item_t item) +-{ +- /* Do nothing yet */ +-} +- + static void + gpa_context_progress (GpaContext *context, int current, int total) + { +--- a/src/gpacontext.h ++++ b/src/gpacontext.h +@@ -63,7 +63,6 @@ struct _GpaContextClass { + void (*start) (GpaContext *context); + void (*done) (GpaContext *context, gpg_error_t err); + void (*next_key) (GpaContext *context, gpgme_key_t key); +- void (*next_trust_item) (GpaContext *context, gpgme_trust_item_t item); + void (*progress) (GpaContext *context, int current, int total); + }; + +-- +2.50.1 + diff --git a/app-crypt/gpa/files/0.11.0/0003-Fix-incorrect-callback-arguments.patch b/app-crypt/gpa/files/0.11.0/0003-Fix-incorrect-callback-arguments.patch new file mode 100644 index 000000000000..a8ba179a8a0b --- /dev/null +++ b/app-crypt/gpa/files/0.11.0/0003-Fix-incorrect-callback-arguments.patch @@ -0,0 +1,69 @@ +From 1bce45d716ba687e794421db6ff061673d204e9d Mon Sep 17 00:00:00 2001 +Message-ID: <1bce45d716ba687e794421db6ff061673d204e9d.1754900600.git....@gentoo.org> +In-Reply-To: <aa63712b18b79b983e3d9cd7ce5105d0ec7ac262.1754900600.git....@gentoo.org> +References: <aa63712b18b79b983e3d9cd7ce5105d0ec7ac262.1754900600.git....@gentoo.org> +From: Sam James <[email protected]> +Date: Sun, 10 Aug 2025 03:31:47 +0100 +Subject: [PATCH 3/3] Fix incorrect callback arguments + +Some users reported a crash downstream in Gentoo with g_type_check_is_value_type +getting a garbage type. This turns out to be because +95e07080a2a08196cafb05b69345ea1d629424b1 replaced the types (and argument +counts) incorrectly. + +Fix that by adding to gpa_marshal.list to create custom marshal types +and use those instead, and fix the argument count. + +Bug: https://bugs.gentoo.org/957196 +Fixes: 95e07080a2a08196cafb05b69345ea1d629424b1 +Signed-off-by: Sam James <[email protected]> +--- a/src/gpa-marshal.list ++++ b/src/gpa-marshal.list +@@ -1 +1,3 @@ + INT:STRING,STRING ++VOID:INT,INT ++VOID:POINTER,POINTER +--- a/src/gpacontext.c ++++ b/src/gpacontext.c +@@ -25,6 +25,7 @@ + #include "gpa.h" + #include "gpgmetools.h" + #include "gpacontext.h" ++#include "gpa-marshal.h" + + /* GObject type functions */ + +@@ -145,9 +146,9 @@ gpa_context_class_init (GpaContextClass *klass) + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (GpaContextClass, progress), + NULL, NULL, +- g_cclosure_marshal_VOID__INT, ++ gpa_marshal_VOID__INT_INT, + G_TYPE_NONE, 2, +- G_TYPE_INT); ++ G_TYPE_INT, G_TYPE_INT); + } + + static void +--- a/src/gpakeyexpireop.c ++++ b/src/gpakeyexpireop.c +@@ -31,6 +31,7 @@ + #endif + + #include "gpa.h" ++#include "gpa-marshal.h" + #include "gpakeyexpireop.h" + #include "expirydlg.h" + #include "gpgmeedit.h" +@@ -114,7 +115,7 @@ gpa_key_expire_operation_class_init (GpaKeyExpireOperationClass *klass) + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (GpaKeyExpireOperationClass, new_expiration), + NULL, NULL, +- g_cclosure_marshal_VOID__POINTER, ++ gpa_marshal_VOID__POINTER_POINTER, + G_TYPE_NONE, 2, + G_TYPE_POINTER, + G_TYPE_POINTER); +-- +2.50.1 + diff --git a/app-crypt/gpa/files/gpa-0.11.0-c99.patch b/app-crypt/gpa/files/gpa-0.11.0-c99.patch deleted file mode 100644 index bc34bc95bbbe..000000000000 --- a/app-crypt/gpa/files/gpa-0.11.0-c99.patch +++ /dev/null @@ -1,17 +0,0 @@ -cm-piv.c: In function ‘reload_data’: -cm-piv.c:510:7: error: implicit declaration of function ‘gpa_keytable_ensure’ [-Wimplicit-function-declaration] - 510 | gpa_keytable_ensure (gpa_keytable_get_secret_instance()); - | ^~~~~~~~~~~~~~~~~~~ -cm-piv.c:510:28: error: implicit declaration of function ‘gpa_keytable_get_secret_instance’ [-Wimplicit-function-declaration] - 510 | gpa_keytable_ensure (gpa_keytable_get_secret_instance()); - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ---- a/src/cm-piv.c -+++ b/src/cm-piv.c -@@ -41,6 +41,7 @@ - #include "gtktools.h" - #include "convert.h" - #include "gpa-key-details.h" -+#include "keytable.h" - - #include "cm-object.h" - #include "cm-piv.h" diff --git a/app-crypt/gpa/gpa-0.11.0.ebuild b/app-crypt/gpa/gpa-0.11.0-r1.ebuild similarity index 94% rename from app-crypt/gpa/gpa-0.11.0.ebuild rename to app-crypt/gpa/gpa-0.11.0-r1.ebuild index b72f07a6dcaa..c327b2e57f0a 100644 --- a/app-crypt/gpa/gpa-0.11.0.ebuild +++ b/app-crypt/gpa/gpa-0.11.0-r1.ebuild @@ -28,7 +28,8 @@ BDEPEND=" " PATCHES=( - "${FILESDIR}"/${PN}-0.11.0-c99.patch + # Backports, drop on bump + "${FILESDIR}"/${PV} ) src_prepare() {
