Skip to content

Commit 739ecff

Browse files
committed
Patch glib for CVE-2026-1484
1 parent cc8a3e3 commit 739ecff

2 files changed

Lines changed: 70 additions & 2 deletions

File tree

SPECS/glib/CVE-2026-1484.patch

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
From 5ba0ed9ab2c28294713bdc56a8744ff0a446b59c Mon Sep 17 00:00:00 2001
2+
From: Marco Trevisan <mail@3v1n0.net>
3+
Date: Fri, 23 Jan 2026 18:48:30 +0100
4+
Subject: [PATCH 1/2] gbase64: Use gsize to prevent potential overflow
5+
[PATCH 2/2] gbase64: Ensure that the out value is within allocated
6+
MIME-Version: 1.0
7+
Content-Type: text/plain; charset=UTF-8
8+
Content-Transfer-Encoding: 8bit
9+
10+
Both g_base64_encode_step() and g_base64_encode_close() return gsize
11+
values, but these are summed to an int value.
12+
13+
If the sum of these returned values is bigger than MAXINT, we overflow
14+
while doing the null byte write.
15+
16+
Spotted by treeplus.
17+
Thanks to the Sovereign Tech Resilience programme from the Sovereign
18+
Tech Agency.
19+
20+
ID: #YWH-PGM9867-168
21+
Closes: #3870
22+
23+
24+
(cherry picked from commit 6845f7776982849a2be1d8c9b0495e389092bff2)
25+
Upstream Patch reference: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4979.patch
26+
27+
Co-authored-by: Marco Trevisan (Treviño) <mail@3v1n0.net>
28+
---
29+
glib/gbase64.c | 11 +++++++++--
30+
1 file changed, 9 insertions(+), 2 deletions(-)
31+
32+
diff --git a/glib/gbase64.c b/glib/gbase64.c
33+
index f2d110e..19f8e5e 100644
34+
--- a/glib/gbase64.c
35+
+++ b/glib/gbase64.c
36+
@@ -262,8 +262,10 @@ g_base64_encode (const guchar *data,
37+
gsize len)
38+
{
39+
gchar *out;
40+
- gint state = 0, outlen;
41+
+ gint state = 0;
42+
gint save = 0;
43+
+ gsize outlen;
44+
+ gsize allocsize;
45+
46+
g_return_val_if_fail (data != NULL || len == 0, NULL);
47+
48+
@@ -271,10 +273,15 @@ g_base64_encode (const guchar *data,
49+
+1 is needed for trailing \0, also check for unlikely integer overflow */
50+
g_return_val_if_fail (len < ((G_MAXSIZE - 1) / 4 - 1) * 3, NULL);
51+
52+
- out = g_malloc ((len / 3 + 1) * 4 + 1);
53+
+ allocsize = (len / 3 + 1) * 4 + 1;
54+
+ out = g_malloc (allocsize);
55+
56+
outlen = g_base64_encode_step (data, len, FALSE, out, &state, &save);
57+
+ g_assert (outlen <= allocsize);
58+
+
59+
outlen += g_base64_encode_close (FALSE, out + outlen, &state, &save);
60+
+ g_assert (outlen <= allocsize);
61+
+
62+
out[outlen] = '\0';
63+
64+
return (gchar *) out;
65+
--
66+
2.45.4
67+

SPECS/glib/glib.spec

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Patch6: CVE-2025-13601.patch
2020
Patch7: CVE-2025-14087.patch
2121
Patch8: CVE-2025-14512.patch
2222
Patch9: CVE-2024-34397.patch
23+
Patch10: CVE-2026-1484.patch
2324
BuildRequires: cmake
2425
BuildRequires: gtk-doc
2526
BuildRequires: libffi-devel
@@ -133,8 +134,8 @@ touch %{buildroot}%{_libdir}/gio/modules/giomodule.cache
133134
%doc %{_datadir}/gtk-doc/html/*
134135

135136
%changelog
136-
* Mon Dec 22 2025 Archana Shettigar <v-shettigara@microsoft.com> - 2.71.0-10
137-
- Patch CVE-2024-34397
137+
* Thu Jan 29 2026 Archana Shettigar <v-shettigara@microsoft.com> - 2.71.0-10
138+
- Patch CVE-2024-34397 and CVE-2026-1484
138139

139140
* Mon Dec 15 2025 Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> - 2.71.0-9
140141
- Patch for CVE-2025-14512, CVE-2025-14087

0 commit comments

Comments
 (0)