Backport an upstream patch to fix GParam validation crashes

https://gitlab.gnome.org/GNOME/glib/-/issues/2770
This commit is contained in:
Kalev Lember 2022-09-26 22:34:25 +02:00
parent e812f0dd5f
commit 0a32a39f0d
2 changed files with 37 additions and 0 deletions

33
2921.patch Normal file
View File

@ -0,0 +1,33 @@
From ea3f17d598d550345e94e4571130e429443e91cb Mon Sep 17 00:00:00 2001
From: Emmanuele Bassi <ebassi@gnome.org>
Date: Sun, 25 Sep 2022 14:20:24 +0100
Subject: [PATCH] Empty values are not valid GParamSpec
The validate() vfunc for GParamSpecParam returns FALSE for empty GValue,
which means the is_valid() vfunc should do the same.
This avoids a segfault when calling g_param_value_is_valid() on a
GParamSpecParam.
Fixes: #2770
---
gobject/gparamspecs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/gobject/gparamspecs.c b/gobject/gparamspecs.c
index f17b3488b9..17b8606572 100644
--- a/gobject/gparamspecs.c
+++ b/gobject/gparamspecs.c
@@ -894,6 +894,9 @@ param_param_is_valid (GParamSpec *pspec,
{
GParamSpec *param = value->data[0].v_pointer;
+ if (param == NULL)
+ return FALSE;
+
return g_value_type_compatible (G_PARAM_SPEC_TYPE (param), G_PARAM_SPEC_VALUE_TYPE (pspec));
}
--
GitLab

View File

@ -12,6 +12,10 @@ Source0: https://download.gnome.org/sources/glib/2.72/glib-%{version}.tar.xz
# https://gitlab.gnome.org/GNOME/glib/-/merge_requests/903
Patch0: gnutls-hmac.patch
# Backported from upstream
# https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2921
Patch1: 2921.patch
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: gettext