summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/CVE-2025-4373-01.patch120
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/CVE-2025-4373-02.patch29
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0_2.78.6.bb2
3 files changed, 151 insertions, 0 deletions
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/CVE-2025-4373-01.patch b/meta/recipes-core/glib-2.0/glib-2.0/CVE-2025-4373-01.patch
new file mode 100644
index 0000000000..f99c4de7e1
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/CVE-2025-4373-01.patch
@@ -0,0 +1,120 @@
1From cc647f9e46d55509a93498af19659baf9c80f2e3 Mon Sep 17 00:00:00 2001
2From: Michael Catanzaro <mcatanzaro@redhat.com>
3Date: Thu, 10 Apr 2025 10:57:20 -0500
4Subject: [PATCH 1/2] gstring: carefully handle gssize parameters
5
6Wherever we use gssize to allow passing -1, we need to ensure we don't
7overflow the value by assigning a gsize to it without checking if the
8size exceeds the maximum gssize. The safest way to do this is to just
9use normal gsize everywhere instead and use gssize only for the
10parameter.
11
12Our computers don't have enough RAM to write tests for this. I tried
13forcing string->len to high values for test purposes, but this isn't
14valid and will just cause out of bounds reads/writes due to
15string->allocated_len being unexpectedly small, so I don't think we can
16test this easily.
17
18CVE: CVE-2025-4373
19
20Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/-/commit/cc647f9e46d55509a93498af19659baf9c80f2e3]
21
22Signed-off-by: Praveen Kumar <praveen.kumar@windriver.com>
23---
24 glib/gstring.c | 36 +++++++++++++++++++++++-------------
25 1 file changed, 23 insertions(+), 13 deletions(-)
26
27diff --git a/glib/gstring.c b/glib/gstring.c
28index 9f04144..d016b65 100644
29--- a/glib/gstring.c
30+++ b/glib/gstring.c
31@@ -490,8 +490,9 @@ g_string_insert_len (GString *string,
32 return string;
33
34 if (len < 0)
35- len = strlen (val);
36- len_unsigned = len;
37+ len_unsigned = strlen (val);
38+ else
39+ len_unsigned = len;
40
41 if (pos < 0)
42 pos_unsigned = string->len;
43@@ -788,10 +789,12 @@ g_string_insert_c (GString *string,
44 g_string_maybe_expand (string, 1);
45
46 if (pos < 0)
47- pos = string->len;
48+ pos_unsigned = string->len;
49 else
50- g_return_val_if_fail ((gsize) pos <= string->len, string);
51- pos_unsigned = pos;
52+ {
53+ pos_unsigned = pos;
54+ g_return_val_if_fail (pos_unsigned <= string->len, string);
55+ }
56
57 /* If not just an append, move the old stuff */
58 if (pos_unsigned < string->len)
59@@ -824,6 +827,7 @@ g_string_insert_unichar (GString *string,
60 gssize pos,
61 gunichar wc)
62 {
63+ gsize pos_unsigned;
64 gint charlen, first, i;
65 gchar *dest;
66
67@@ -865,15 +869,18 @@ g_string_insert_unichar (GString *string,
68 g_string_maybe_expand (string, charlen);
69
70 if (pos < 0)
71- pos = string->len;
72+ pos_unsigned = string->len;
73 else
74- g_return_val_if_fail ((gsize) pos <= string->len, string);
75+ {
76+ pos_unsigned = pos;
77+ g_return_val_if_fail (pos_unsigned <= string->len, string);
78+ }
79
80 /* If not just an append, move the old stuff */
81- if ((gsize) pos < string->len)
82- memmove (string->str + pos + charlen, string->str + pos, string->len - pos);
83+ if (pos_unsigned < string->len)
84+ memmove (string->str + pos_unsigned + charlen, string->str + pos_unsigned, string->len - pos_unsigned);
85
86- dest = string->str + pos;
87+ dest = string->str + pos_unsigned;
88 /* Code copied from g_unichar_to_utf() */
89 for (i = charlen - 1; i > 0; --i)
90 {
91@@ -931,6 +938,7 @@ g_string_overwrite_len (GString *string,
92 const gchar *val,
93 gssize len)
94 {
95+ gssize len_unsigned;
96 gsize end;
97
98 g_return_val_if_fail (string != NULL, NULL);
99@@ -942,14 +950,16 @@ g_string_overwrite_len (GString *string,
100 g_return_val_if_fail (pos <= string->len, string);
101
102 if (len < 0)
103- len = strlen (val);
104+ len_unsigned = strlen (val);
105+ else
106+ len_unsigned = len;
107
108- end = pos + len;
109+ end = pos + len_unsigned;
110
111 if (end > string->len)
112 g_string_maybe_expand (string, end - string->len);
113
114- memcpy (string->str + pos, val, len);
115+ memcpy (string->str + pos, val, len_unsigned);
116
117 if (end > string->len)
118 {
119--
1202.40.0
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/CVE-2025-4373-02.patch b/meta/recipes-core/glib-2.0/glib-2.0/CVE-2025-4373-02.patch
new file mode 100644
index 0000000000..ea586c90dc
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/CVE-2025-4373-02.patch
@@ -0,0 +1,29 @@
1From 4d435bb4809793c445846db8fb87e3c9184c4703 Mon Sep 17 00:00:00 2001
2From: Peter Bloomfield <peterbloomfield@bellsouth.net>
3Date: Fri, 11 Apr 2025 05:52:33 +0000
4Subject: [PATCH 2/2] gstring: Make len_unsigned unsigned
5
6CVE: CVE-2025-4373
7
8Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/-/commit/4d435bb4809793c445846db8fb87e3c9184c4703]
9
10Signed-off-by: Praveen Kumar <praveen.kumar@windriver.com>
11---
12 glib/gstring.c | 2 +-
13 1 file changed, 1 insertion(+), 1 deletion(-)
14
15diff --git a/glib/gstring.c b/glib/gstring.c
16index d016b65..d9ad0c3 100644
17--- a/glib/gstring.c
18+++ b/glib/gstring.c
19@@ -938,7 +938,7 @@ g_string_overwrite_len (GString *string,
20 const gchar *val,
21 gssize len)
22 {
23- gssize len_unsigned;
24+ gsize len_unsigned;
25 gsize end;
26
27 g_return_val_if_fail (string != NULL, NULL);
28--
292.40.0
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 1a65f48399..e1a3b57270 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
@@ -27,6 +27,8 @@ SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \
27 file://CVE-2025-3360-04.patch \ 27 file://CVE-2025-3360-04.patch \
28 file://CVE-2025-3360-05.patch \ 28 file://CVE-2025-3360-05.patch \
29 file://CVE-2025-3360-06.patch \ 29 file://CVE-2025-3360-06.patch \
30 file://CVE-2025-4373-01.patch \
31 file://CVE-2025-4373-02.patch \
30 " 32 "
31SRC_URI:append:class-native = " file://relocate-modules.patch \ 33SRC_URI:append:class-native = " file://relocate-modules.patch \
32 file://0001-meson.build-do-not-enable-pidfd-features-on-native-g.patch \ 34 file://0001-meson.build-do-not-enable-pidfd-features-on-native-g.patch \