public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/glib2] cve-2026-58016-f44: Fix a regression that affected fwupd
@ 2026-08-11 10:38 Richard Hughes
  0 siblings, 0 replies; only message in thread
From: Richard Hughes @ 2026-08-11 10:38 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/glib2
Branch : cve-2026-58016-f44
Commit : d6d90adecff75fed76d78b36020d1c061e73e3d8
Author : Richard Hughes <richard@hughsie.com>
Date   : 2024-11-20T16:26:52+00:00
Stats  : +49/-0 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/glib2/c/d6d90adecff75fed76d78b36020d1c061e73e3d8?branch=cve-2026-58016-f44

Log:
Fix a regression that affected fwupd

---
diff --git a/0001-glib-gbytes-Be-more-careful-when-saving-a-GBytes-of-.patch b/0001-glib-gbytes-Be-more-careful-when-saving-a-GBytes-of-.patch
new file mode 100644
index 0000000..7de1417
--- /dev/null
+++ b/0001-glib-gbytes-Be-more-careful-when-saving-a-GBytes-of-.patch
@@ -0,0 +1,46 @@
+From 9ddc97314ba4313493f0979455a13838de1317ac Mon Sep 17 00:00:00 2001
+From: Richard Hughes <richard@hughsie.com>
+Date: Wed, 20 Nov 2024 13:28:25 +0000
+Subject: [PATCH] glib/gbytes: Be more careful when saving a GBytes of NULL
+
+In 1e3b010 the behaviour of `g_bytes_new (NULL, 0)` was changed; before the
+`g_bytes_get_data()` would return NULL as expected, but now it returns a pointer
+outside the single GBytes allocation.
+
+This breaks the fwupd self tests as we use a GBytes of NULL to signify that
+the emulation data exists, but it has no content.
+
+Catch this case and restore the old behaviour.
+---
+ glib/gbytes.c      | 2 +-
+ glib/tests/bytes.c | 1 +
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/glib/gbytes.c b/glib/gbytes.c
+index 9b358c4a0..a3647caee 100644
+--- a/glib/gbytes.c
++++ b/glib/gbytes.c
+@@ -128,7 +128,7 @@ g_bytes_new (gconstpointer data,
+       GBytesInline *bytes;
+ 
+       bytes = g_malloc (sizeof *bytes + size);
+-      bytes->bytes.data = bytes->inline_data;
++      bytes->bytes.data = data != NULL ? bytes->inline_data : NULL;
+       bytes->bytes.size = size;
+       bytes->bytes.free_func = NULL;
+       bytes->bytes.user_data = NULL;
+diff --git a/glib/tests/bytes.c b/glib/tests/bytes.c
+index 16a08e222..7d432fdee 100644
+--- a/glib/tests/bytes.c
++++ b/glib/tests/bytes.c
+@@ -451,6 +451,7 @@ test_null (void)
+   gsize size;
+ 
+   bytes = g_bytes_new (NULL, 0);
++  g_assert_null (g_bytes_get_data (bytes, NULL));
+ 
+   data = g_bytes_unref_to_data (bytes, &size);
+ 
+-- 
+2.47.0
+

diff --git a/glib2.spec b/glib2.spec
index e3cd448..eff2b53 100644
--- a/glib2.spec
+++ b/glib2.spec
@@ -15,6 +15,9 @@ Patch:          gnutls-hmac.patch
 # https://bugzilla.redhat.com/show_bug.cgi?id=2192204
 Patch:          default-terminal.patch
 
+# https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4406
+Patch:          0001-glib-gbytes-Be-more-careful-when-saving-a-GBytes-of-.patch
+
 BuildRequires:  gcc
 BuildRequires:  gcc-c++
 BuildRequires:  gettext

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-11 10:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-11 10:38 [rpms/glib2] cve-2026-58016-f44: Fix a regression that affected fwupd Richard Hughes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox