From 99e6f79ecec914623e9f321e25235a9a027db384 Mon Sep 17 00:00:00 2001 From: RHEL Packaging Agent Date: Wed, 22 Jul 2026 16:24:15 +0000 Subject: [PATCH] Fix CVE-2026-58010: off-by-one error in gvs_tuple_is_normal() Backport upstream fix for CVE-2026-58010 from GNOME/glib MR !5129 to mingw-glib2 2.70.1. The fix corrects an off-by-one error in gvs_tuple_is_normal() in glib/gvariant-serialiser.c that allowed a single byte out-of-bounds read when checking a GVariant for normal form. A regression test is included. CVE: CVE-2026-58010 Upstream patches: - https://gitlab.gnome.org/GNOME/glib/-/merge_requests/5129.patch Resolves: RHEL-212164 This commit was backported by Ymir, a Red Hat Enterprise Linux software maintenance AI agent. Assisted-by: Ymir --- mingw-glib2-2.70.1-CVE-2026-58010.patch | 106 ++++++++++++++++++++++++ mingw-glib2.spec | 10 ++- 2 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 mingw-glib2-2.70.1-CVE-2026-58010.patch diff --git a/mingw-glib2-2.70.1-CVE-2026-58010.patch b/mingw-glib2-2.70.1-CVE-2026-58010.patch new file mode 100644 index 0000000..9cff400 --- /dev/null +++ b/mingw-glib2-2.70.1-CVE-2026-58010.patch @@ -0,0 +1,106 @@ +From eb63e89e237d35fb1d3cb757ea97b4c8806269a0 Mon Sep 17 00:00:00 2001 +From: Philip Withnall +Date: Sun, 29 Mar 2026 19:10:41 +0100 +Subject: [PATCH] gvariant: Fix an off-by-one error in an offset comparison +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This allows a single byte out-of-bounds read off the end of the +(potentially untrusted) byte array backing a `GVariant` when it’s +being checked for normal form. + +I can’t see how this could practically be exploited, but it’s certainly +a security bug as the `GVariant` normal form checking code is supposed +to be robust to malicious inputs. + +Spotted by linhlhq as #YWH-PGM9867-190, and fix and reproducer provided +by them too, thanks. Confirmed and turned into a unit test by me. + +Signed-off-by: Philip Withnall + +Fixes: #3915 +--- + glib/gvariant-serialiser.c | 2 +- + glib/tests/gvariant.c | 48 ++++++++++++++++++++++++++++++++++++++ + 2 files changed, 49 insertions(+), 1 deletion(-) + +diff --git a/glib/gvariant-serialiser.c b/glib/gvariant-serialiser.c +index 832a8fdc2..1bf3e4688 100644 +--- a/glib/gvariant-serialiser.c ++++ b/glib/gvariant-serialiser.c +@@ -1079,7 +1079,7 @@ gvs_tuple_is_normal (GVariantSerialised value) + + while (offset & alignment) + { +- if (offset > value.size || value.data[offset] != '\0') ++ if (offset >= value.size || value.data[offset] != '\0') + return FALSE; + offset++; + } +diff --git a/glib/tests/gvariant.c b/glib/tests/gvariant.c +index 0110f2664..dd3af6941 100644 +--- a/glib/tests/gvariant.c ++++ b/glib/tests/gvariant.c +@@ -5047,6 +5047,52 @@ test_normal_checking_tuple_offsets (void) + g_variant_unref (variant); + } + ++/* This is a regression test that looping over the padding bytes in a short ++ * (non-normal) tuple doesn’t overflow the input data. ++ * ++ * See https://gitlab.gnome.org/GNOME/glib/-/issues/3915 */ ++static void ++test_normal_checking_tuple_offsets6 (void) ++{ ++ /* ++ * Type: (ynqiuxthdsog) — 12 members, first member 'y' (byte) has ++ * alignment 0, second 'n' (int16) has alignment 1. ++ * With 1 byte of data (0x28), after reading the first byte member, ++ * offset=1, alignment check for 'n' requires offset to be even, ++ * so the while loop checks value.data[1] — but size is only 1. ++ * ++ * Use heap allocation via GBytes so ASan reports heap-buffer-overflow. ++ */ ++ uint8_t *heap_data = NULL; ++ GBytes *bytes = NULL; ++ const GVariantType *data_type = G_VARIANT_TYPE ("(ynqiuxthdsog)"); ++ GVariant *variant = NULL; ++ GVariant *normal_variant = NULL; ++ GVariant *expected = NULL; ++ ++ g_test_bug ("https://gitlab.gnome.org/GNOME/glib/-/issues/3915"); ++ ++ heap_data = g_malloc (1); ++ heap_data[0] = 0x28; ++ bytes = g_bytes_new_take (heap_data, 1); ++ ++ variant = g_variant_new_from_bytes (data_type, bytes, FALSE); ++ g_assert_nonnull (variant); ++ ++ g_assert_false (g_variant_is_normal_form (variant)); ++ ++ normal_variant = g_variant_get_normal_form (variant); ++ g_assert_nonnull (normal_variant); ++ ++ expected = g_variant_new_parsed ("(byte 0x28, int16 0, uint16 0, 0, uint32 0, int64 0, uint64 0, handle 0, 0.0, '', objectpath '/', signature '')"); ++ g_assert_cmpvariant (expected, variant); ++ g_assert_cmpvariant (expected, normal_variant); ++ ++ g_variant_unref (expected); ++ g_variant_unref (normal_variant); ++ g_variant_unref (variant); ++} ++ + /* Test that an empty object path is normalised successfully to the base object + * path, ‘/’. */ + static void +@@ -5191,6 +5237,8 @@ main (int argc, char **argv) + test_normal_checking_array_offsets); + g_test_add_func ("/gvariant/normal-checking/tuple-offsets", + test_normal_checking_tuple_offsets); ++ g_test_add_func ("/gvariant/normal-checking/tuple-offsets6", ++ test_normal_checking_tuple_offsets6); + g_test_add_func ("/gvariant/normal-checking/empty-object-path", + test_normal_checking_empty_object_path); + diff --git a/mingw-glib2.spec b/mingw-glib2.spec index caabca2..b3564cb 100644 --- a/mingw-glib2.spec +++ b/mingw-glib2.spec @@ -5,7 +5,7 @@ Name: mingw-glib2 Version: 2.70.1 -Release: 8%{?dist} +Release: 9%{?dist} Summary: MinGW Windows GLib2 library License: LGPLv2+ @@ -77,6 +77,9 @@ Patch8: mingw-glib2-2.70.1-CVE-2026-58013.patch # https://gitlab.gnome.org/GNOME/glib/-/issues/3917 Patch9: mingw-glib2-2.70.1-CVE-2026-58011.patch +# https://gitlab.gnome.org/GNOME/glib/-/issues/3915 +Patch10: mingw-glib2-2.70.1-CVE-2026-58010.patch + %description MinGW Windows Glib2 library. @@ -131,6 +134,7 @@ Static version of the MinGW Windows GLib2 library. %patch7 -p1 %patch8 -p1 %patch9 -p1 +%patch10 -p1 %build %mingw_meson --default-library=both \ @@ -308,6 +312,10 @@ find $RPM_BUILD_ROOT -name "*.la" -delete %changelog +* Wed Jul 22 2026 RHEL Packaging Agent - 2.70.1-9 +- Fix CVE-2026-58010: off-by-one error in gvs_tuple_is_normal() + Resolves: RHEL-212164 + * Wed Jul 22 2026 RHEL Packaging Agent - 2.70.1-8 - Fix CVE-2026-58011: g_date_time_add_full() range validation Resolves: RHEL-212184