summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhang Peng <peng.zhang1.cn@windriver.com>2025-01-16 15:26:48 +0800
committerSteve Sakoman <steve@sakoman.com>2025-01-24 07:49:28 -0800
commit4ebaec2ca32b275dd2b39e0020e965e29fb6b387 (patch)
treefa2dae62a5f0ff71704b41dd4be2b6d58088e01e
parent0d7adecb6bc3688cbce9ca3822507775499ced64 (diff)
downloadpoky-4ebaec2ca32b275dd2b39e0020e965e29fb6b387.tar.gz
vte: fix CVE-2024-37535
CVE-2024-37535: GNOME VTE before 0.76.3 allows an attacker to cause a denial of service (memory consumption) via a window resize escape sequence, a related issue to CVE-2000-0476. Reference: [https://nvd.nist.gov/vuln/detail/CVE-2024-37535] Upstream patches: [https://gitlab.gnome.org/GNOME/vte/-/commit/036bc3ddcbb56f05c6ca76712a53b89dee1369e2] [https://gitlab.gnome.org/GNOME/vte/-/commit/c313849c2e5133802e21b13fa0b141b360171d39] (From OE-Core rev: 132a5168b125d6f4fb9391d982bc64d73429ab8f) Signed-off-by: Zhang Peng <peng.zhang1.cn@windriver.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/recipes-support/vte/vte/CVE-2024-37535-0001.patch63
-rw-r--r--meta/recipes-support/vte/vte/CVE-2024-37535-0002.patch85
-rw-r--r--meta/recipes-support/vte/vte_0.66.2.bb9
3 files changed, 155 insertions, 2 deletions
diff --git a/meta/recipes-support/vte/vte/CVE-2024-37535-0001.patch b/meta/recipes-support/vte/vte/CVE-2024-37535-0001.patch
new file mode 100644
index 0000000000..f7c84323fb
--- /dev/null
+++ b/meta/recipes-support/vte/vte/CVE-2024-37535-0001.patch
@@ -0,0 +1,63 @@
1From 036bc3ddcbb56f05c6ca76712a53b89dee1369e2 Mon Sep 17 00:00:00 2001
2From: Christian Persch <chpe@src.gnome.org>
3Date: Sun, 2 Jun 2024 19:19:35 +0200
4Subject: [PATCH] emulation: Restrict resize request to sane numbers
5
6Fixes: https://gitlab.gnome.org/GNOME/vte/-/issues/2786
7(cherry picked from commit fd5511f24b7269195a7083f409244e9787c705dc)
8
9CVE: CVE-2024-37535
10Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/vte/-/commit/036bc3ddcbb56f05c6ca76712a53b89dee1369e2]
11
12Signed-off-by: Zhang Peng <peng.zhang1.cn@windriver.com>
13---
14 src/vteseq.cc | 20 ++++++++++++--------
15 1 file changed, 12 insertions(+), 8 deletions(-)
16
17diff --git a/src/vteseq.cc b/src/vteseq.cc
18index 2c5b1e128..5b3f398e2 100644
19--- a/src/vteseq.cc
20+++ b/src/vteseq.cc
21@@ -213,9 +213,18 @@ Terminal::emit_bell()
22 /* Emit a "resize-window" signal. (Grid size.) */
23 void
24 Terminal::emit_resize_window(guint columns,
25- guint rows)
26-{
27- _vte_debug_print(VTE_DEBUG_SIGNALS, "Emitting `resize-window'.\n");
28+ guint rows)
29+{
30+ // Ignore resizes with excessive number of rows or columns,
31+ // see https://gitlab.gnome.org/GNOME/vte/-/issues/2786
32+ if (columns < VTE_MIN_GRID_WIDTH ||
33+ columns > 511 ||
34+ rows < VTE_MIN_GRID_HEIGHT ||
35+ rows > 511)
36+ return;
37+
38+ _vte_debug_print(VTE_DEBUG_SIGNALS, "Emitting `resize-window' %d columns %d rows.\n",
39+ columns, rows);
40 g_signal_emit(m_terminal, signals[SIGNAL_RESIZE_WINDOW], 0, columns, rows);
41 }
42
43@@ -4467,8 +4476,6 @@ Terminal::DECSLPP(vte::parser::Sequence const& seq)
44 else if (param < 24)
45 return;
46
47- _vte_debug_print(VTE_DEBUG_EMULATION, "Resizing to %d rows.\n", param);
48-
49 emit_resize_window(m_column_count, param);
50 }
51
52@@ -8990,9 +8997,6 @@ Terminal::XTERM_WM(vte::parser::Sequence const& seq)
53 seq.collect(1, {&height, &width});
54
55 if (width != -1 && height != -1) {
56- _vte_debug_print(VTE_DEBUG_EMULATION,
57- "Resizing window to %d columns, %d rows.\n",
58- width, height);
59 emit_resize_window(width, height);
60 }
61 break;
62--
63GitLab
diff --git a/meta/recipes-support/vte/vte/CVE-2024-37535-0002.patch b/meta/recipes-support/vte/vte/CVE-2024-37535-0002.patch
new file mode 100644
index 0000000000..c396817060
--- /dev/null
+++ b/meta/recipes-support/vte/vte/CVE-2024-37535-0002.patch
@@ -0,0 +1,85 @@
1From c313849c2e5133802e21b13fa0b141b360171d39 Mon Sep 17 00:00:00 2001
2From: Christian Persch <chpe@src.gnome.org>
3Date: Sun, 2 Jun 2024 19:19:35 +0200
4Subject: [PATCH] widget: Add safety limit to widget size requests
5
6https://gitlab.gnome.org/GNOME/vte/-/issues/2786
7(cherry picked from commit 1803ba866053a3d7840892b9d31fe2944a183eda)
8
9CVE: CVE-2024-37535
10Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/vte/-/commit/c313849c2e5133802e21b13fa0b141b360171d39]
11
12Signed-off-by: Zhang Peng <peng.zhang1.cn@windriver.com>
13---
14 src/vtegtk.cc | 35 +++++++++++++++++++++++++++++++++++
15 1 file changed, 35 insertions(+)
16
17diff --git a/src/vtegtk.cc b/src/vtegtk.cc
18index 24bdd7184..48cae79c1 100644
19--- a/src/vtegtk.cc
20+++ b/src/vtegtk.cc
21@@ -91,6 +91,38 @@
22 template<typename T>
23 constexpr bool check_enum_value(T value) noexcept;
24
25+static inline void
26+sanitise_widget_size_request(int* minimum,
27+ int* natural) noexcept
28+{
29+ // Overly large size requests will make gtk happily allocate
30+ // a window size over the window system's limits (see
31+ // e.g. https://gitlab.gnome.org/GNOME/vte/-/issues/2786),
32+ // leading to aborting the whole process.
33+ // The toolkit should be in a better position to know about
34+ // these limits and not exceed them (which here is certainly
35+ // possible since our minimum sizes are very small), let's
36+ // limit the widget's size request to some large value
37+ // that hopefully is within the absolute limits of
38+ // the window system (assumed here to be int16 range,
39+ // and leaving some space for the widgets that contain
40+ // the terminal).
41+ auto const limit = (1 << 15) - (1 << 12);
42+
43+ if (*minimum > limit || *natural > limit) {
44+ static auto warned = false;
45+
46+ if (!warned) {
47+ g_warning("Widget size request (minimum %d, natural %d) exceeds limits\n",
48+ *minimum, *natural);
49+ warned = true;
50+ }
51+ }
52+
53+ *minimum = std::min(*minimum, limit);
54+ *natural = std::clamp(*natural, *minimum, limit);
55+}
56+
57 struct _VteTerminalClassPrivate {
58 GtkStyleProvider *style_provider;
59 };
60@@ -510,6 +542,7 @@ try
61 {
62 VteTerminal *terminal = VTE_TERMINAL(widget);
63 WIDGET(terminal)->get_preferred_width(minimum_width, natural_width);
64+ sanitise_widget_size_request(minimum_width, natural_width);
65 }
66 catch (...)
67 {
68@@ -524,6 +557,7 @@ try
69 {
70 VteTerminal *terminal = VTE_TERMINAL(widget);
71 WIDGET(terminal)->get_preferred_height(minimum_height, natural_height);
72+ sanitise_widget_size_request(minimum_height, natural_height);
73 }
74 catch (...)
75 {
76@@ -781,6 +815,7 @@ try
77 WIDGET(terminal)->measure(orientation, for_size,
78 minimum, natural,
79 minimum_baseline, natural_baseline);
80+ sanitise_widget_size_request(minimum, natural);
81 }
82 catch (...)
83 {
84--
85GitLab
diff --git a/meta/recipes-support/vte/vte_0.66.2.bb b/meta/recipes-support/vte/vte_0.66.2.bb
index af1c47cf80..365e4361cb 100644
--- a/meta/recipes-support/vte/vte_0.66.2.bb
+++ b/meta/recipes-support/vte/vte_0.66.2.bb
@@ -19,8 +19,13 @@ GIR_MESON_OPTION = 'gir'
19inherit gnomebase gtk-doc features_check upstream-version-is-even gobject-introspection 19inherit gnomebase gtk-doc features_check upstream-version-is-even gobject-introspection
20 20
21# vapigen.m4 is required when vala is not present (but the one from vala should be used normally) 21# vapigen.m4 is required when vala is not present (but the one from vala should be used normally)
22SRC_URI += "file://0001-Add-W_EXITCODE-macro-for-non-glibc-systems.patch \ 22SRC_URI += " \
23 file://0001-Makefile.docs-correctly-substitute-gtkdoc-qemu-wrapp.patch" 23 file://0001-Add-W_EXITCODE-macro-for-non-glibc-systems.patch \
24 file://0001-Makefile.docs-correctly-substitute-gtkdoc-qemu-wrapp.patch \
25 file://CVE-2024-37535-0001.patch \
26 file://CVE-2024-37535-0002.patch \
27 "
28
24SRC_URI[archive.sha256sum] = "e89974673a72a0a06edac6d17830b82bb124decf0cb3b52cebc92ec3ff04d976" 29SRC_URI[archive.sha256sum] = "e89974673a72a0a06edac6d17830b82bb124decf0cb3b52cebc92ec3ff04d976"
25 30
26ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" 31ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}"