summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core
diff options
context:
space:
mode:
authorPeter Marko <peter.marko@siemens.com>2026-02-20 17:21:32 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2026-02-27 17:45:07 +0000
commit0e148ac345111ac77f8d30d7365df932b6a6f6a4 (patch)
tree8b54b9f3d6c7474601f90babe2c2ff370d2f4be3 /meta/recipes-core
parente1fb45c7b3b57ddc2d7cfa274cdd75f0b5ff01d6 (diff)
downloadpoky-0e148ac345111ac77f8d30d7365df932b6a6f6a4.tar.gz
glib-2.0: patch CVE-2026-1489
Pick patch from [1] linked from [2]. [1] https://gitlab.gnome.org/GNOME/glib/-/issues/3872 [2] https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4984 (From OE-Core rev: a032cc36df3cbd084ca8ae1a8fa638274dd71318) Signed-off-by: Peter Marko <peter.marko@siemens.com> Signed-off-by: Yoann Congal <yoann.congal@smile.fr> Signed-off-by: Paul Barker <paul@pbarker.dev> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/CVE-2026-1489-01.patch42
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/CVE-2026-1489-02.patch30
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/CVE-2026-1489-03.patch290
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/CVE-2026-1489-04.patch68
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0_2.78.6.bb4
5 files changed, 434 insertions, 0 deletions
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/CVE-2026-1489-01.patch b/meta/recipes-core/glib-2.0/glib-2.0/CVE-2026-1489-01.patch
new file mode 100644
index 0000000000..8f72bf972e
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/CVE-2026-1489-01.patch
@@ -0,0 +1,42 @@
1From 662aa569efa65eaa4672ab0671eb8533a354cd89 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
3Date: Wed, 21 Jan 2026 22:00:17 +0100
4Subject: [PATCH] guniprop: Use size_t for output_marks length
5
6The input string length may overflow, and this would lead to wrong
7behavior and invalid writes.
8
9Spotted by treeplus.
10Thanks to the Sovereign Tech Resilience programme from the Sovereign
11Tech Agency.
12
13ID: #YWH-PGM9867-171
14Closes: #3872
15
16CVE: CVE-2026-1489
17Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/-/commit/662aa569efa65eaa4672ab0671eb8533a354cd89]
18Signed-off-by: Peter Marko <peter.marko@siemens.com>
19---
20 glib/guniprop.c | 4 ++--
21 1 file changed, 2 insertions(+), 2 deletions(-)
22
23diff --git a/glib/guniprop.c b/glib/guniprop.c
24index fe0033fd6..1a0cc6408 100644
25--- a/glib/guniprop.c
26+++ b/glib/guniprop.c
27@@ -772,13 +772,13 @@ get_locale_type (void)
28 return LOCALE_NORMAL;
29 }
30
31-static gint
32+static size_t
33 output_marks (const char **p_inout,
34 char *out_buffer,
35 gboolean remove_dot)
36 {
37 const char *p = *p_inout;
38- gint len = 0;
39+ size_t len = 0;
40
41 while (*p)
42 {
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/CVE-2026-1489-02.patch b/meta/recipes-core/glib-2.0/glib-2.0/CVE-2026-1489-02.patch
new file mode 100644
index 0000000000..4d3db5bf4e
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/CVE-2026-1489-02.patch
@@ -0,0 +1,30 @@
1From 58356619525a1d565df8cc348e9784716f020f2f Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
3Date: Wed, 21 Jan 2026 22:01:49 +0100
4Subject: [PATCH] guniprop: Do not convert size_t to gint
5
6We were correctly using size_t in output_special_case() since commit
7362f92b69, but then we converted the value back to int
8
9Related to: #3872
10
11CVE: CVE-2026-1489
12Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/-/commit/58356619525a1d565df8cc348e9784716f020f2f]
13Signed-off-by: Peter Marko <peter.marko@siemens.com>
14---
15 glib/guniprop.c | 2 +-
16 1 file changed, 1 insertion(+), 1 deletion(-)
17
18diff --git a/glib/guniprop.c b/glib/guniprop.c
19index 1a0cc6408..fe50a287c 100644
20--- a/glib/guniprop.c
21+++ b/glib/guniprop.c
22@@ -798,7 +798,7 @@ output_marks (const char **p_inout,
23 return len;
24 }
25
26-static gint
27+static size_t
28 output_special_case (gchar *out_buffer,
29 int offset,
30 int type,
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/CVE-2026-1489-03.patch b/meta/recipes-core/glib-2.0/glib-2.0/CVE-2026-1489-03.patch
new file mode 100644
index 0000000000..9ff9a37fcb
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/CVE-2026-1489-03.patch
@@ -0,0 +1,290 @@
1From 170dc8c4068db4c4cbf63c7d27192e230436da21 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
3Date: Wed, 21 Jan 2026 22:04:22 +0100
4Subject: [PATCH] guniprop: Ensure we do not overflow size in
5 g_utf8_{strdown,gstrup}()
6
7While this is technically not a security issue, when repeatedly adding
8to a size_t value, we can overflow and start from 0.
9
10Now, while being unlikely, technically an utf8 lower or upper string can
11have a longer size than the input value, and if the output string is
12bigger than G_MAXSIZE we'd end up cutting it silently.
13
14Let's instead assert each time we increase the output length
15
16CVE: CVE-2026-1489
17Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/-/commit/170dc8c4068db4c4cbf63c7d27192e230436da21]
18Signed-off-by: Peter Marko <peter.marko@siemens.com>
19---
20 glib/guniprop.c | 109 +++++++++++++++++++++++++++++++-----------------
21 1 file changed, 70 insertions(+), 39 deletions(-)
22
23diff --git a/glib/guniprop.c b/glib/guniprop.c
24index fe50a287c..86020b6e0 100644
25--- a/glib/guniprop.c
26+++ b/glib/guniprop.c
27@@ -772,14 +772,36 @@ get_locale_type (void)
28 return LOCALE_NORMAL;
29 }
30
31-static size_t
32-output_marks (const char **p_inout,
33- char *out_buffer,
34- gboolean remove_dot)
35+G_ALWAYS_INLINE static inline void
36+increase_size (size_t *sizeptr, size_t add)
37+{
38+ g_assert (G_MAXSIZE - *(sizeptr) >= add);
39+ *(sizeptr) += add;
40+}
41+
42+G_ALWAYS_INLINE static inline void
43+append_utf8_char_to_buffer (gunichar c,
44+ char *out_buffer,
45+ size_t *in_out_len)
46+{
47+ gint utf8_len;
48+ char *buffer;
49+
50+ buffer = out_buffer ? out_buffer + *(in_out_len) : NULL;
51+ utf8_len = g_unichar_to_utf8 (c, buffer);
52+
53+ g_assert (utf8_len >= 0);
54+ increase_size (in_out_len, utf8_len);
55+}
56+
57+static void
58+append_mark (const char **p_inout,
59+ char *out_buffer,
60+ size_t *in_out_len,
61+ gboolean remove_dot)
62 {
63 const char *p = *p_inout;
64- size_t len = 0;
65-
66+
67 while (*p)
68 {
69 gunichar c = g_utf8_get_char (p);
70@@ -787,7 +809,7 @@ output_marks (const char **p_inout,
71 if (ISMARK (TYPE (c)))
72 {
73 if (!remove_dot || c != 0x307 /* COMBINING DOT ABOVE */)
74- len += g_unichar_to_utf8 (c, out_buffer ? out_buffer + len : NULL);
75+ append_utf8_char_to_buffer (c, out_buffer, in_out_len);
76 p = g_utf8_next_char (p);
77 }
78 else
79@@ -795,14 +817,14 @@ output_marks (const char **p_inout,
80 }
81
82 *p_inout = p;
83- return len;
84 }
85
86-static size_t
87-output_special_case (gchar *out_buffer,
88- int offset,
89- int type,
90- int which)
91+static void
92+append_special_case (char *out_buffer,
93+ size_t *in_out_len,
94+ int offset,
95+ int type,
96+ int which)
97 {
98 const gchar *p = special_case_table + offset;
99 gint len;
100@@ -814,10 +836,12 @@ output_special_case (gchar *out_buffer,
101 p += strlen (p) + 1;
102
103 len = strlen (p);
104- if (out_buffer)
105- memcpy (out_buffer, p, len);
106+ g_assert (len < G_MAXSIZE - *in_out_len);
107
108- return len;
109+ if (out_buffer)
110+ memcpy (out_buffer + *in_out_len, p, len);
111+
112+ increase_size (in_out_len, len);
113 }
114
115 static gsize
116@@ -858,11 +882,13 @@ real_toupper (const gchar *str,
117 decomp_len = g_unichar_fully_decompose (c, FALSE, decomp, G_N_ELEMENTS (decomp));
118 for (i=0; i < decomp_len; i++)
119 {
120+
121 if (decomp[i] != 0x307 /* COMBINING DOT ABOVE */)
122- len += g_unichar_to_utf8 (g_unichar_toupper (decomp[i]), out_buffer ? out_buffer + len : NULL);
123+ append_utf8_char_to_buffer (g_unichar_toupper (decomp[i]),
124+ out_buffer, &len);
125 }
126-
127- len += output_marks (&p, out_buffer ? out_buffer + len : NULL, TRUE);
128+
129+ append_mark (&p, out_buffer, &len, TRUE);
130
131 continue;
132 }
133@@ -875,17 +901,17 @@ real_toupper (const gchar *str,
134 if (locale_type == LOCALE_TURKIC && c == 'i')
135 {
136 /* i => LATIN CAPITAL LETTER I WITH DOT ABOVE */
137- len += g_unichar_to_utf8 (0x130, out_buffer ? out_buffer + len : NULL);
138+ append_utf8_char_to_buffer (0x130, out_buffer, &len);
139 }
140 else if (c == 0x0345) /* COMBINING GREEK YPOGEGRAMMENI */
141 {
142 /* Nasty, need to move it after other combining marks .. this would go away if
143 * we normalized first.
144 */
145- len += output_marks (&p, out_buffer ? out_buffer + len : NULL, FALSE);
146+ append_mark (&p, out_buffer, &len, TRUE);
147
148 /* And output as GREEK CAPITAL LETTER IOTA */
149- len += g_unichar_to_utf8 (0x399, out_buffer ? out_buffer + len : NULL);
150+ append_utf8_char_to_buffer (0x399, out_buffer, &len);
151 }
152 else if (IS (t,
153 OR (G_UNICODE_LOWERCASE_LETTER,
154@@ -896,8 +922,8 @@ real_toupper (const gchar *str,
155
156 if (val >= 0x1000000)
157 {
158- len += output_special_case (out_buffer ? out_buffer + len : NULL, val - 0x1000000, t,
159- t == G_UNICODE_LOWERCASE_LETTER ? 0 : 1);
160+ append_special_case (out_buffer, &len, val - 0x1000000, t,
161+ t == G_UNICODE_LOWERCASE_LETTER ? 0 : 1);
162 }
163 else
164 {
165@@ -917,7 +943,7 @@ real_toupper (const gchar *str,
166 /* Some lowercase letters, e.g., U+000AA, FEMININE ORDINAL INDICATOR,
167 * do not have an uppercase equivalent, in which case val will be
168 * zero. */
169- len += g_unichar_to_utf8 (val ? val : c, out_buffer ? out_buffer + len : NULL);
170+ append_utf8_char_to_buffer (val ? val : c, out_buffer, &len);
171 }
172 }
173 else
174@@ -927,7 +953,7 @@ real_toupper (const gchar *str,
175 if (out_buffer)
176 memcpy (out_buffer + len, last, char_len);
177
178- len += char_len;
179+ increase_size (&len, char_len);
180 }
181
182 }
183@@ -965,6 +991,8 @@ g_utf8_strup (const gchar *str,
184 * We use a two pass approach to keep memory management simple
185 */
186 result_len = real_toupper (str, len, NULL, locale_type);
187+ g_assert (result_len < G_MAXSIZE);
188+
189 result = g_malloc (result_len + 1);
190 real_toupper (str, len, result, locale_type);
191 result[result_len] = '\0';
192@@ -1022,14 +1050,15 @@ real_tolower (const gchar *str,
193 {
194 /* I + COMBINING DOT ABOVE => i (U+0069)
195 * LATIN CAPITAL LETTER I WITH DOT ABOVE => i (U+0069) */
196- len += g_unichar_to_utf8 (0x0069, out_buffer ? out_buffer + len : NULL);
197+ append_utf8_char_to_buffer (0x0069, out_buffer, &len);
198+
199 if (combining_dot)
200 p = g_utf8_next_char (p);
201 }
202 else
203 {
204 /* I => LATIN SMALL LETTER DOTLESS I */
205- len += g_unichar_to_utf8 (0x131, out_buffer ? out_buffer + len : NULL);
206+ append_utf8_char_to_buffer (0x131, out_buffer, &len);
207 }
208 }
209 /* Introduce an explicit dot above when lowercasing capital I's and J's
210@@ -1037,19 +1066,19 @@ real_tolower (const gchar *str,
211 else if (locale_type == LOCALE_LITHUANIAN &&
212 (c == 0x00cc || c == 0x00cd || c == 0x0128))
213 {
214- len += g_unichar_to_utf8 (0x0069, out_buffer ? out_buffer + len : NULL);
215- len += g_unichar_to_utf8 (0x0307, out_buffer ? out_buffer + len : NULL);
216+ append_utf8_char_to_buffer (0x0069, out_buffer, &len);
217+ append_utf8_char_to_buffer (0x0307, out_buffer, &len);
218
219 switch (c)
220 {
221 case 0x00cc:
222- len += g_unichar_to_utf8 (0x0300, out_buffer ? out_buffer + len : NULL);
223+ append_utf8_char_to_buffer (0x0300, out_buffer, &len);
224 break;
225 case 0x00cd:
226- len += g_unichar_to_utf8 (0x0301, out_buffer ? out_buffer + len : NULL);
227+ append_utf8_char_to_buffer (0x0301, out_buffer, &len);
228 break;
229 case 0x0128:
230- len += g_unichar_to_utf8 (0x0303, out_buffer ? out_buffer + len : NULL);
231+ append_utf8_char_to_buffer (0x0303, out_buffer, &len);
232 break;
233 }
234 }
235@@ -1058,8 +1087,8 @@ real_tolower (const gchar *str,
236 c == 'J' || c == G_UNICHAR_FULLWIDTH_J || c == 0x012e) &&
237 has_more_above (p))
238 {
239- len += g_unichar_to_utf8 (g_unichar_tolower (c), out_buffer ? out_buffer + len : NULL);
240- len += g_unichar_to_utf8 (0x0307, out_buffer ? out_buffer + len : NULL);
241+ append_utf8_char_to_buffer (g_unichar_tolower (c), out_buffer, &len);
242+ append_utf8_char_to_buffer (0x0307, out_buffer, &len);
243 }
244 else if (c == 0x03A3) /* GREEK CAPITAL LETTER SIGMA */
245 {
246@@ -1082,7 +1111,7 @@ real_tolower (const gchar *str,
247 else
248 val = 0x3c2; /* GREEK SMALL FINAL SIGMA */
249
250- len += g_unichar_to_utf8 (val, out_buffer ? out_buffer + len : NULL);
251+ append_utf8_char_to_buffer (val, out_buffer, &len);
252 }
253 else if (IS (t,
254 OR (G_UNICODE_UPPERCASE_LETTER,
255@@ -1093,7 +1122,7 @@ real_tolower (const gchar *str,
256
257 if (val >= 0x1000000)
258 {
259- len += output_special_case (out_buffer ? out_buffer + len : NULL, val - 0x1000000, t, 0);
260+ append_special_case (out_buffer, &len, val - 0x1000000, t, 0);
261 }
262 else
263 {
264@@ -1112,7 +1141,7 @@ real_tolower (const gchar *str,
265
266 /* Not all uppercase letters are guaranteed to have a lowercase
267 * equivalent. If this is the case, val will be zero. */
268- len += g_unichar_to_utf8 (val ? val : c, out_buffer ? out_buffer + len : NULL);
269+ append_utf8_char_to_buffer (val ? val : c, out_buffer, &len);
270 }
271 }
272 else
273@@ -1122,7 +1151,7 @@ real_tolower (const gchar *str,
274 if (out_buffer)
275 memcpy (out_buffer + len, last, char_len);
276
277- len += char_len;
278+ increase_size (&len, char_len);
279 }
280
281 }
282@@ -1159,6 +1188,8 @@ g_utf8_strdown (const gchar *str,
283 * We use a two pass approach to keep memory management simple
284 */
285 result_len = real_tolower (str, len, NULL, locale_type);
286+ g_assert (result_len < G_MAXSIZE);
287+
288 result = g_malloc (result_len + 1);
289 real_tolower (str, len, result, locale_type);
290 result[result_len] = '\0';
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/CVE-2026-1489-04.patch b/meta/recipes-core/glib-2.0/glib-2.0/CVE-2026-1489-04.patch
new file mode 100644
index 0000000000..15322efacd
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/CVE-2026-1489-04.patch
@@ -0,0 +1,68 @@
1From b96966058f4291db8970ced70ee22103e63679e5 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <mail@3v1n0.net>
3Date: Fri, 23 Jan 2026 17:39:34 +0100
4Subject: [PATCH] glib/tests/unicode: Add test debug information when parsing
5 input files
6
7On case of failures makes it easier to understand on what line of the
8source file we're at, as it might not be clear for non-ascii chars
9
10CVE: CVE-2026-1489
11Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/-/commit/b96966058f4291db8970ced70ee22103e63679e5]
12Signed-off-by: Peter Marko <peter.marko@siemens.com>
13---
14 glib/tests/unicode.c | 10 ++++++++++
15 1 file changed, 10 insertions(+)
16
17diff --git a/glib/tests/unicode.c b/glib/tests/unicode.c
18index 90b5a98b8..44d1083dd 100644
19--- a/glib/tests/unicode.c
20+++ b/glib/tests/unicode.c
21@@ -600,6 +600,7 @@ test_casemap_and_casefold (void)
22 const char *locale;
23 const char *test;
24 const char *expected;
25+ size_t line = 0;
26 char *convert;
27 char *current_locale = setlocale (LC_CTYPE, NULL);
28 char *old_lc_all, *old_lc_messages, *old_lang;
29@@ -620,6 +621,7 @@ test_casemap_and_casefold (void)
30
31 while (fgets (buffer, sizeof (buffer), infile))
32 {
33+ line++;
34 if (buffer[0] == '#')
35 continue;
36
37@@ -662,6 +664,9 @@ test_casemap_and_casefold (void)
38
39 convert = g_utf8_strup (test, -1);
40 expected = strings[4][0] ? strings[4] : test;
41+ g_test_message ("Converting '%s' => '%s' (line %" G_GSIZE_FORMAT ")",
42+ test, expected, line);
43+
44 g_assert_cmpstr (convert, ==, expected);
45 g_free (convert);
46
47@@ -681,9 +686,11 @@ test_casemap_and_casefold (void)
48
49 infile = fopen (filename, "r");
50 g_assert (infile != NULL);
51+ line = 0;
52
53 while (fgets (buffer, sizeof (buffer), infile))
54 {
55+ line++;
56 if (buffer[0] == '#')
57 continue;
58
59@@ -693,6 +700,9 @@ test_casemap_and_casefold (void)
60 test = strings[0];
61
62 convert = g_utf8_casefold (test, -1);
63+ g_test_message ("Converting '%s' => '%s' (line %" G_GSIZE_FORMAT ")",
64+ test, strings[1], line);
65+
66 g_assert_cmpstr (convert, ==, strings[1]);
67 g_free (convert);
68
diff --git a/meta/recipes-core/glib-2.0/glib-2.0_2.78.6.bb b/meta/recipes-core/glib-2.0/glib-2.0_2.78.6.bb
index fefa3ad7d6..b8212c9d12 100644
--- a/meta/recipes-core/glib-2.0/glib-2.0_2.78.6.bb
+++ b/meta/recipes-core/glib-2.0/glib-2.0_2.78.6.bb
@@ -43,6 +43,10 @@ SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \
43 file://CVE-2026-1484-01.patch \ 43 file://CVE-2026-1484-01.patch \
44 file://CVE-2026-1484-02.patch \ 44 file://CVE-2026-1484-02.patch \
45 file://CVE-2026-1485.patch \ 45 file://CVE-2026-1485.patch \
46 file://CVE-2026-1489-01.patch \
47 file://CVE-2026-1489-02.patch \
48 file://CVE-2026-1489-03.patch \
49 file://CVE-2026-1489-04.patch \
46 " 50 "
47SRC_URI:append:class-native = " file://relocate-modules.patch \ 51SRC_URI:append:class-native = " file://relocate-modules.patch \
48 file://0001-meson.build-do-not-enable-pidfd-features-on-native-g.patch \ 52 file://0001-meson.build-do-not-enable-pidfd-features-on-native-g.patch \