mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-08-02 11:38:07 -07:00
dev-libs/glib: fix UB w/ const attribute
This broke glib with GCC 16. Closes: https://bugs.gentoo.org/970774 Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
99
dev-libs/glib/files/glib-2.84.4-fix-const-attribute.patch
Normal file
99
dev-libs/glib/files/glib-2.84.4-fix-const-attribute.patch
Normal file
@@ -0,0 +1,99 @@
|
||||
https://bugs.gentoo.org/970774
|
||||
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/5145
|
||||
|
||||
From 9f5903a96f419058d457de7b7544c2bc9e73e510 Mon Sep 17 00:00:00 2001
|
||||
From: Sam James <sam@gentoo.org>
|
||||
Date: Fri, 10 Apr 2026 02:28:48 +0100
|
||||
Subject: [PATCH] gvarianttype: use pure attribute, not inappropriate const
|
||||
|
||||
As found in https://gcc.gnu.org/PR124837, it is wrong to use the const
|
||||
attribute [0] for g_variant_type_*is* because it may be called repeatedly
|
||||
with different pointed-to data. The pure attribute [1] is what we want
|
||||
here because it allows pointed-to data to change, so change to that.
|
||||
|
||||
const would be OK here if it pointed to a constant buffer, but it doesn't,
|
||||
it points to newly malloc'd memory from all over the place.
|
||||
|
||||
[0] https://gcc.gnu.org/onlinedocs/gcc-15.2.0/gcc/Common-Function-Attributes.html#index-const-function-attribute
|
||||
[1] https://gcc.gnu.org/onlinedocs/gcc-15.2.0/gcc/Common-Function-Attributes.html#index-pure-function-attribute
|
||||
|
||||
Fixes: 49bfa7b9cf8b16f7f6a5b1db565575d61a37100f
|
||||
Signed-off-by: Sam James <sam@gentoo.org>
|
||||
---
|
||||
glib/gvarianttype.h | 32 ++++++++++++++++----------------
|
||||
1 file changed, 16 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/glib/gvarianttype.h b/glib/gvarianttype.h
|
||||
index 38980af829..3a57b9131a 100644
|
||||
--- a/glib/gvarianttype.h
|
||||
+++ b/glib/gvarianttype.h
|
||||
@@ -302,7 +302,7 @@ typedef struct _GVariantType GVariantType;
|
||||
|
||||
/* type string checking */
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
-gboolean g_variant_type_string_is_valid (const gchar *type_string) G_GNUC_CONST;
|
||||
+gboolean g_variant_type_string_is_valid (const gchar *type_string) G_GNUC_PURE;
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
gboolean g_variant_type_string_scan (const gchar *string,
|
||||
const gchar *limit,
|
||||
@@ -326,21 +326,21 @@ gchar * g_variant_type_dup_string (const G
|
||||
|
||||
/* classification */
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
-gboolean g_variant_type_is_definite (const GVariantType *type) G_GNUC_CONST;
|
||||
+gboolean g_variant_type_is_definite (const GVariantType *type) G_GNUC_PURE;
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
-gboolean g_variant_type_is_container (const GVariantType *type) G_GNUC_CONST;
|
||||
+gboolean g_variant_type_is_container (const GVariantType *type) G_GNUC_PURE;
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
-gboolean g_variant_type_is_basic (const GVariantType *type) G_GNUC_CONST;
|
||||
+gboolean g_variant_type_is_basic (const GVariantType *type) G_GNUC_PURE;
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
-gboolean g_variant_type_is_maybe (const GVariantType *type) G_GNUC_CONST;
|
||||
+gboolean g_variant_type_is_maybe (const GVariantType *type) G_GNUC_PURE;
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
-gboolean g_variant_type_is_array (const GVariantType *type) G_GNUC_CONST;
|
||||
+gboolean g_variant_type_is_array (const GVariantType *type) G_GNUC_PURE;
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
-gboolean g_variant_type_is_tuple (const GVariantType *type) G_GNUC_CONST;
|
||||
+gboolean g_variant_type_is_tuple (const GVariantType *type) G_GNUC_PURE;
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
-gboolean g_variant_type_is_dict_entry (const GVariantType *type) G_GNUC_CONST;
|
||||
+gboolean g_variant_type_is_dict_entry (const GVariantType *type) G_GNUC_PURE;
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
-gboolean g_variant_type_is_variant (const GVariantType *type) G_GNUC_CONST;
|
||||
+gboolean g_variant_type_is_variant (const GVariantType *type) G_GNUC_PURE;
|
||||
|
||||
/* for hash tables */
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
@@ -352,21 +352,21 @@ gboolean g_variant_type_equal (gconstp
|
||||
/* subtypes */
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
gboolean g_variant_type_is_subtype_of (const GVariantType *type,
|
||||
- const GVariantType *supertype) G_GNUC_CONST;
|
||||
+ const GVariantType *supertype) G_GNUC_PURE;
|
||||
|
||||
/* type iterator interface */
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
-const GVariantType * g_variant_type_element (const GVariantType *type) G_GNUC_CONST;
|
||||
+const GVariantType * g_variant_type_element (const GVariantType *type) G_GNUC_PURE;
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
-const GVariantType * g_variant_type_first (const GVariantType *type) G_GNUC_CONST;
|
||||
+const GVariantType * g_variant_type_first (const GVariantType *type) G_GNUC_PURE;
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
-const GVariantType * g_variant_type_next (const GVariantType *type) G_GNUC_CONST;
|
||||
+const GVariantType * g_variant_type_next (const GVariantType *type) G_GNUC_PURE;
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
-gsize g_variant_type_n_items (const GVariantType *type) G_GNUC_CONST;
|
||||
+gsize g_variant_type_n_items (const GVariantType *type) G_GNUC_PURE;
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
-const GVariantType * g_variant_type_key (const GVariantType *type) G_GNUC_CONST;
|
||||
+const GVariantType * g_variant_type_key (const GVariantType *type) G_GNUC_PURE;
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
-const GVariantType * g_variant_type_value (const GVariantType *type) G_GNUC_CONST;
|
||||
+const GVariantType * g_variant_type_value (const GVariantType *type) G_GNUC_PURE;
|
||||
|
||||
/* constructors */
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
--
|
||||
GitLab
|
||||
@@ -97,6 +97,7 @@ PATCHES=(
|
||||
"${FILESDIR}"/${PN}-2.86-MR-4934-CVE-2025-14087.patch
|
||||
"${FILESDIR}"/${PN}-2.86-MR-4936.patch
|
||||
"${FILESDIR}"/${PN}-2.84.4-setlocale-glibc-2.43.patch
|
||||
"${FILESDIR}"/${PN}-2.84.4-fix-const-attribute.patch
|
||||
)
|
||||
|
||||
python_check_deps() {
|
||||
@@ -92,6 +92,7 @@ MULTILIB_CHOST_TOOLS=(
|
||||
PATCHES=(
|
||||
"${FILESDIR}"/${PN}-2.64.1-mark-gdbus-server-auth-test-flaky.patch
|
||||
"${FILESDIR}"/${PN}-2.84.4-setlocale-glibc-2.43.patch
|
||||
"${FILESDIR}"/${PN}-2.84.4-fix-const-attribute.patch
|
||||
)
|
||||
|
||||
python_check_deps() {
|
||||
@@ -91,6 +91,7 @@ MULTILIB_CHOST_TOOLS=(
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}"/${PN}-2.64.1-mark-gdbus-server-auth-test-flaky.patch
|
||||
"${FILESDIR}"/${PN}-2.84.4-fix-const-attribute.patch
|
||||
)
|
||||
|
||||
python_check_deps() {
|
||||
Reference in New Issue
Block a user