public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Richard Hughes <richard@hughsie.com>
To: git-commits@fedoraproject.org
Subject: [rpms/glib2] cve-2026-58016-f44: Fix a regression that affected fwupd
Date: Tue, 11 Aug 2026 10:38:25 GMT	[thread overview]
Message-ID: <178644470549.1.3890286189052829188.rpms-glib2-d6d90adecff7@fedoraproject.org> (raw)

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

                 reply	other threads:[~2026-08-11 10:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=178644470549.1.3890286189052829188.rpms-glib2-d6d90adecff7@fedoraproject.org \
    --to=richard@hughsie.com \
    --cc=git-commits@fedoraproject.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