summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-devtools/qemu/qemu.inc1
-rw-r--r--meta/recipes-devtools/qemu/qemu/CVE-2022-3165.patch59
2 files changed, 60 insertions, 0 deletions
diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc
index 711982ba8d..55aced9f9a 100644
--- a/meta/recipes-devtools/qemu/qemu.inc
+++ b/meta/recipes-devtools/qemu/qemu.inc
@@ -29,6 +29,7 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
29 file://0010-hw-pvrdma-Protect-against-buggy-or-malicious-guest-d.patch \ 29 file://0010-hw-pvrdma-Protect-against-buggy-or-malicious-guest-d.patch \
30 file://0001-net-tulip-Restrict-DMA-engine-to-memories.patch \ 30 file://0001-net-tulip-Restrict-DMA-engine-to-memories.patch \
31 file://arm-cpreg-fix.patch \ 31 file://arm-cpreg-fix.patch \
32 file://CVE-2022-3165.patch \
32 " 33 "
33UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar" 34UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar"
34 35
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2022-3165.patch b/meta/recipes-devtools/qemu/qemu/CVE-2022-3165.patch
new file mode 100644
index 0000000000..3b4a6694c2
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/CVE-2022-3165.patch
@@ -0,0 +1,59 @@
1CVE: CVE-2022-3165
2Upstream-Status: Backport
3Signed-off-by: Ross Burton <ross.burton@arm.com>
4
5From d307040b18bfcb1393b910f1bae753d5c12a4dc7 Mon Sep 17 00:00:00 2001
6From: Mauro Matteo Cascella <mcascell@redhat.com>
7Date: Sun, 25 Sep 2022 22:45:11 +0200
8Subject: [PATCH] ui/vnc-clipboard: fix integer underflow in
9 vnc_client_cut_text_ext
10
11Extended ClientCutText messages start with a 4-byte header. If len < 4,
12an integer underflow occurs in vnc_client_cut_text_ext. The result is
13used to decompress data in a while loop in inflate_buffer, leading to
14CPU consumption and denial of service. Prevent this by checking dlen in
15protocol_client_msg.
16
17Fixes: CVE-2022-3165
18Fixes: 0bf41cab93e5 ("ui/vnc: clipboard support")
19Reported-by: TangPeng <tangpeng@qianxin.com>
20Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
21Message-Id: <20220925204511.1103214-1-mcascell@redhat.com>
22Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
23---
24 ui/vnc.c | 11 ++++++++---
25 1 file changed, 8 insertions(+), 3 deletions(-)
26
27diff --git a/ui/vnc.c b/ui/vnc.c
28index 6a05d06147..acb3629cd8 100644
29--- a/ui/vnc.c
30+++ b/ui/vnc.c
31@@ -2442,8 +2442,8 @@ static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len)
32 if (len == 1) {
33 return 8;
34 }
35+ uint32_t dlen = abs(read_s32(data, 4));
36 if (len == 8) {
37- uint32_t dlen = abs(read_s32(data, 4));
38 if (dlen > (1 << 20)) {
39 error_report("vnc: client_cut_text msg payload has %u bytes"
40 " which exceeds our limit of 1MB.", dlen);
41@@ -2456,8 +2456,13 @@ static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len)
42 }
43
44 if (read_s32(data, 4) < 0) {
45- vnc_client_cut_text_ext(vs, abs(read_s32(data, 4)),
46- read_u32(data, 8), data + 12);
47+ if (dlen < 4) {
48+ error_report("vnc: malformed payload (header less than 4 bytes)"
49+ " in extended clipboard pseudo-encoding.");
50+ vnc_client_error(vs);
51+ break;
52+ }
53+ vnc_client_cut_text_ext(vs, dlen, read_u32(data, 8), data + 12);
54 break;
55 }
56 vnc_client_cut_text(vs, read_u32(data, 4), data + 8);
57--
58GitLab
59