* [QEMU HCI-8.0 PATCH 01/15] ui/vnc-jobs: fix VncRectEntry leak on job cleanup
2026-09-04 10:11 [QEMU HCI-8.0 PATCH 00/15] VNC stability fixes Andrey Drobyshev
@ 2026-09-04 10:11 ` Andrey Drobyshev
2026-09-04 10:11 ` [QEMU HCI-8.0 PATCH 02/15] ui/vnc: fix OOB read access in VNC SASL mechname array Andrey Drobyshev
` (13 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Andrey Drobyshev @ 2026-09-04 10:11 UTC (permalink / raw)
To: svt-core; +Cc: andrey.drobyshev, den
From: Marc-André Lureau <marcandre.lureau@redhat.com>
When a VncJob is freed, its associated VncRectEntry list must also be
freed. Previously, vnc_job_push() and the disconnected path in
vnc_worker_thread_loop() called g_free(job) directly, leaking all
VncRectEntry allocations.
Introduce vnc_job_free() which iterates and frees the rectangle entries
before freeing the job itself, and use it in both paths.
Also add QLIST_REMOVE() in the worker loop before g_free(entry), so
that entries processed during normal operation are properly unlinked.
Without this, vnc_job_free() would iterate dangling pointers to
already-freed entries, causing use-after-free.
Fixes: bd023f953e5e ("vnc: threaded VNC server")
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
(cherry picked from commit 3cae0b46be5416b26039df5259ffc8fcf2989516)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit ccffe22759e733f002c19d762431441d8570fdda)
---
ui/vnc-jobs.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/ui/vnc-jobs.c b/ui/vnc-jobs.c
index bed33950a87..d2a3c676b0e 100644
--- a/ui/vnc-jobs.c
+++ b/ui/vnc-jobs.c
@@ -108,11 +108,25 @@ int vnc_job_add_rect(VncJob *job, int x, int y, int w, int h)
return 1;
}
+static void vnc_job_free(VncJob *job)
+{
+ VncRectEntry *entry, *tmp;
+
+ if (!job) {
+ return;
+ }
+ QLIST_FOREACH_SAFE(entry, &job->rectangles, next, tmp) {
+ /* no need for QLIST_REMOVE(entry, next) */
+ g_free(entry);
+ }
+ g_free(job);
+}
+
void vnc_job_push(VncJob *job)
{
vnc_lock_queue(queue);
if (queue->exit || QLIST_EMPTY(&job->rectangles)) {
- g_free(job);
+ vnc_job_free(job);
} else {
QTAILQ_INSERT_TAIL(&queue->jobs, job, next);
qemu_cond_broadcast(&queue->cond);
@@ -297,6 +311,7 @@ static int vnc_worker_thread_loop(VncJobQueue *queue)
n_rectangles += n;
}
}
+ QLIST_REMOVE(entry, next);
g_free(entry);
}
trace_vnc_job_nrects(&vs, job, n_rectangles);
@@ -325,7 +340,7 @@ disconnected:
QTAILQ_REMOVE(&queue->jobs, job, next);
vnc_unlock_queue(queue);
qemu_cond_broadcast(&queue->cond);
- g_free(job);
+ vnc_job_free(job);
vs.magic = 0;
return 0;
}
--
2.47.1
^ permalink raw reply [flat|nested] 16+ messages in thread* [QEMU HCI-8.0 PATCH 02/15] ui/vnc: fix OOB read access in VNC SASL mechname array
2026-09-04 10:11 [QEMU HCI-8.0 PATCH 00/15] VNC stability fixes Andrey Drobyshev
2026-09-04 10:11 ` [QEMU HCI-8.0 PATCH 01/15] ui/vnc-jobs: fix VncRectEntry leak on job cleanup Andrey Drobyshev
@ 2026-09-04 10:11 ` Andrey Drobyshev
2026-09-04 10:11 ` [QEMU HCI-8.0 PATCH 03/15] ui/vnc: fix OOB write in VNC stats array Andrey Drobyshev
` (12 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Andrey Drobyshev @ 2026-09-04 10:11 UTC (permalink / raw)
To: svt-core; +Cc: andrey.drobyshev, den
From: Daniel P. Berrangé <berrange@redhat.com>
When reading the SASL mechname array off the VNC connection, if
malicious, the received data may contain embedded NULs. If this
happens the memory buffer returned by g_strndup may be shorter
than the original data. Unfortunately the code continued to
index into this buffer with an offset equal to the original
length. This is a potential OOB read of the array.
Fixes: 5847d9e1 (ui/vnc: simplify and avoid strncpy)
Reported-by: boy juju <agx1657748706@gmail.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20260521103353.1645561-2-berrange@redhat.com>
(cherry picked from commit ae18df638fb4285c7b645f98c43f5ebc2e123a55)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit 3b489576ee4d64247731553157443f29e51c7716)
---
ui/vnc-auth-sasl.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c
index 09dafba18d3..ab8fb42dd84 100644
--- a/ui/vnc-auth-sasl.c
+++ b/ui/vnc-auth-sasl.c
@@ -490,6 +490,8 @@ static int protocol_client_auth_sasl_mechname(VncState *vs, uint8_t *data, size_
char *mechname = g_strndup((const char *) data, len);
trace_vnc_auth_sasl_mech_choose(vs, mechname);
+ /* If 'data' had embedded NUL the dup'd string might now be shorter */
+ len = strlen(mechname);
if (strncmp(vs->sasl.mechlist, mechname, len) == 0) {
if (vs->sasl.mechlist[len] != '\0' &&
vs->sasl.mechlist[len] != ',') {
--
2.47.1
^ permalink raw reply [flat|nested] 16+ messages in thread* [QEMU HCI-8.0 PATCH 03/15] ui/vnc: fix OOB write in VNC stats array
2026-09-04 10:11 [QEMU HCI-8.0 PATCH 00/15] VNC stability fixes Andrey Drobyshev
2026-09-04 10:11 ` [QEMU HCI-8.0 PATCH 01/15] ui/vnc-jobs: fix VncRectEntry leak on job cleanup Andrey Drobyshev
2026-09-04 10:11 ` [QEMU HCI-8.0 PATCH 02/15] ui/vnc: fix OOB read access in VNC SASL mechname array Andrey Drobyshev
@ 2026-09-04 10:11 ` Andrey Drobyshev
2026-09-04 10:11 ` [QEMU HCI-8.0 PATCH 04/15] ui/vnc: fix OOB write in lossy rect worker code Andrey Drobyshev
` (11 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Andrey Drobyshev @ 2026-09-04 10:11 UTC (permalink / raw)
To: svt-core; +Cc: andrey.drobyshev, den
From: Daniel P. Berrangé <berrange@redhat.com>
The VncSurface struct maintains update statistics in an array:
VncRectStat stats[VNC_STAT_ROWS][VNC_STAT_COLS];
where the dimensions are defined as:
#define VNC_STAT_RECT 64
#define VNC_STAT_COLS (VNC_MAX_WIDTH / VNC_STAT_RECT)
#define VNC_STAT_ROWS (VNC_MAX_HEIGHT / VNC_STAT_RECT)
If VNC_MAX_WIDTH / VNC_MAX_HEIGHT are not an exact multiple of
VNC_STAT_REC, the COLS/ROWS will be undersized by 1.
Unfortunately:
#define VNC_MAX_HEIGHT 2160
is not a multiple of 64, so there is potential for OOB reads and
writes in the 'stats' array, if the guest surface is over 2112
pixels in height. An array overflow occurs when vnc_update_stats()
records new statistics, either scribbling over data later in the
VncDisplay struct that 'stats' is embedded in, or performing an
OOB write on the allocated struct memory.
Fixes: CVE-2026-48002
Reported-by: boy juju <agx1657748706@gmail.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20260521103353.1645561-3-berrange@redhat.com>
(cherry picked from commit c3c6226fa48180edf9d4646d4112fb1becbc149b)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit 4f22b8179f5fc9bf3b2e0a7d9ee01c3a4d6ba664)
---
ui/vnc.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ui/vnc.h b/ui/vnc.h
index f2dab2f4d96..102648e70e0 100644
--- a/ui/vnc.h
+++ b/ui/vnc.h
@@ -92,8 +92,8 @@ typedef void VncSendHextileTile(VncState *vs,
#define VNC_DIRTY_BPL(x) (sizeof((x)->dirty) / VNC_MAX_HEIGHT * BITS_PER_BYTE)
#define VNC_STAT_RECT 64
-#define VNC_STAT_COLS (VNC_MAX_WIDTH / VNC_STAT_RECT)
-#define VNC_STAT_ROWS (VNC_MAX_HEIGHT / VNC_STAT_RECT)
+#define VNC_STAT_COLS DIV_ROUND_UP(VNC_MAX_WIDTH, VNC_STAT_RECT)
+#define VNC_STAT_ROWS DIV_ROUND_UP(VNC_MAX_HEIGHT, VNC_STAT_RECT)
#define VNC_AUTH_CHALLENGE_SIZE 16
--
2.47.1
^ permalink raw reply [flat|nested] 16+ messages in thread* [QEMU HCI-8.0 PATCH 04/15] ui/vnc: fix OOB write in lossy rect worker code
2026-09-04 10:11 [QEMU HCI-8.0 PATCH 00/15] VNC stability fixes Andrey Drobyshev
` (2 preceding siblings ...)
2026-09-04 10:11 ` [QEMU HCI-8.0 PATCH 03/15] ui/vnc: fix OOB write in VNC stats array Andrey Drobyshev
@ 2026-09-04 10:11 ` Andrey Drobyshev
2026-09-04 10:11 ` [QEMU HCI-8.0 PATCH 05/15] ui/vnc: fix OOB read updating VNC update frequency stats Andrey Drobyshev
` (10 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Andrey Drobyshev @ 2026-09-04 10:11 UTC (permalink / raw)
To: svt-core; +Cc: andrey.drobyshev, den
From: Daniel P. Berrangé <berrange@redhat.com>
Incorrect calculation of the boundary condition when tracking lossy
rectangles in the worker thread will result in an OOB write which
can corrupt further worker state, and/or trigger any guard pages
that may lie beyond the VncWorker struct. This can be triggered
through careful choice of the display resolution in the guest
OS by an unprivileged user.
Fixes: CVE-2026-48002
Reported-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20260521103353.1645561-4-berrange@redhat.com>
[Marc-André - added assert() suggest by philmd@linaro.org]
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
(cherry picked from commit 46ee49034d26d04d95ba8f3183d4fbfa9d2b89b4)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit ed1400016319f8cffb5d6ba8809a8d774976ff65)
---
ui/vnc.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/ui/vnc.c b/ui/vnc.c
index 8ca77b2971f..7373c83b692 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -3005,13 +3005,15 @@ void vnc_sent_lossy_rect(VncWorker *worker, int x, int y, int w, int h)
{
int i, j;
- w = (x + w) / VNC_STAT_RECT;
- h = (y + h) / VNC_STAT_RECT;
+ w = DIV_ROUND_UP((x + w), VNC_STAT_RECT);
+ h = DIV_ROUND_UP((y + h), VNC_STAT_RECT);
+ assert(h <= VNC_STAT_ROWS);
+ assert(w <= VNC_STAT_COLS);
x /= VNC_STAT_RECT;
y /= VNC_STAT_RECT;
- for (j = y; j <= h; j++) {
- for (i = x; i <= w; i++) {
+ for (j = y; j < h; j++) {
+ for (i = x; i < w; i++) {
worker->lossy_rect[j][i] = 1;
}
}
--
2.47.1
^ permalink raw reply [flat|nested] 16+ messages in thread* [QEMU HCI-8.0 PATCH 05/15] ui/vnc: fix OOB read updating VNC update frequency stats
2026-09-04 10:11 [QEMU HCI-8.0 PATCH 00/15] VNC stability fixes Andrey Drobyshev
` (3 preceding siblings ...)
2026-09-04 10:11 ` [QEMU HCI-8.0 PATCH 04/15] ui/vnc: fix OOB write in lossy rect worker code Andrey Drobyshev
@ 2026-09-04 10:11 ` Andrey Drobyshev
2026-09-04 10:11 ` [QEMU HCI-8.0 PATCH 06/15] ui: fix validation of VNC extended clipboard data length Andrey Drobyshev
` (9 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Andrey Drobyshev @ 2026-09-04 10:11 UTC (permalink / raw)
To: svt-core; +Cc: andrey.drobyshev, den
From: Daniel P. Berrangé <berrange@redhat.com>
Incorrect loop bounds in vnc_update_freq result in iterating past the
last row and past the last column in the VNC stats array. With suitably
chosen dimensions this could be a OOB read that accesses memory beyond
the VncDisplay struct that the stats array is embedded in.
Should this hit a guard page, it could trigger a guest crash. If it
does not, then the VNC frequency stats will be updated with garbage.
Fixes: CVE-2026-48003
Reported-by: boy juju <agx1657748706@gmail.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20260521103353.1645561-5-berrange@redhat.com>
(cherry picked from commit d0c7b82d3a89dd9c863f8aa69b07360c648ca9fb)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit a625c70daf64d48c3a86bd50e948ccab69f297aa)
---
ui/vnc.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/ui/vnc.c b/ui/vnc.c
index 7373c83b692..abc83a46e32 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -3116,12 +3116,14 @@ double vnc_update_freq(VncState *vs, int x, int y, int w, int h)
int i, j;
double total = 0;
int num = 0;
+ int x_end = x + w;
+ int y_end = y + h;
x = QEMU_ALIGN_DOWN(x, VNC_STAT_RECT);
y = QEMU_ALIGN_DOWN(y, VNC_STAT_RECT);
- for (j = y; j <= y + h; j += VNC_STAT_RECT) {
- for (i = x; i <= x + w; i += VNC_STAT_RECT) {
+ for (j = y; j < y_end; j += VNC_STAT_RECT) {
+ for (i = x; i < x_end; i += VNC_STAT_RECT) {
total += vnc_stat_rect(vs->vd, i, j)->freq;
num++;
}
--
2.47.1
^ permalink raw reply [flat|nested] 16+ messages in thread* [QEMU HCI-8.0 PATCH 06/15] ui: fix validation of VNC extended clipboard data length
2026-09-04 10:11 [QEMU HCI-8.0 PATCH 00/15] VNC stability fixes Andrey Drobyshev
` (4 preceding siblings ...)
2026-09-04 10:11 ` [QEMU HCI-8.0 PATCH 05/15] ui/vnc: fix OOB read updating VNC update frequency stats Andrey Drobyshev
@ 2026-09-04 10:11 ` Andrey Drobyshev
2026-09-04 10:11 ` [QEMU HCI-8.0 PATCH 07/15] ui/vnc: fix OOB write in vnc_refresh_lossy_rect Andrey Drobyshev
` (8 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Andrey Drobyshev @ 2026-09-04 10:11 UTC (permalink / raw)
To: svt-core; +Cc: andrey.drobyshev, den
From: Heechan Kang <gganji11@naver.com>
QEMU's VNC extended clipboard handler inflates a client-controlled
compressed clipboard payload. The code checks the declared text size
against the total inflated buffer size:
if (tsize < size)
but then copies from:
tbuf = buf + 4;
qemu_clipboard_set_data(..., tsize, tbuf, true);
The correct bound is the remaining data length after the 4-byte length
field, not the total inflated buffer length.
As a result, a VNC client can make QEMU copy up to 3 bytes past the end
of the inflated heap buffer. With a second VNC client, those copied
bytes are observable through the normal VNC extended clipboard PROVIDE
path.
Fixes: CVE-2026-8343
Reported-by: Heechan Kang <gganji11@naver.com>
Reported-by: Feifan Qian <bea1e@proton.me>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Heechan Kang <gganji11@naver.com>
[DB: added #include and 'return' statements]
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260512095543.459949-1-berrange@redhat.com>
(cherry picked from commit e56b4bbff1df260487b80abe1f967f687fa115d3)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit 5501ddefdd6ed544436b5c8a6ecb04ad8673656f)
---
ui/vnc-clipboard.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/ui/vnc-clipboard.c b/ui/vnc-clipboard.c
index 124b6fbd9c2..fa05d86f424 100644
--- a/ui/vnc-clipboard.c
+++ b/ui/vnc-clipboard.c
@@ -23,6 +23,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/error-report.h"
#include "vnc.h"
#include "vnc-jobs.h"
@@ -282,10 +283,16 @@ void vnc_client_cut_text_ext(VncState *vs, int32_t len, uint32_t flags, uint8_t
buf && size >= 4) {
uint32_t tsize = read_u32(buf, 0);
uint8_t *tbuf = buf + 4;
- if (tsize < size) {
+ if (tsize <= size - 4) {
qemu_clipboard_set_data(&vs->cbpeer, vs->cbinfo,
QEMU_CLIPBOARD_TYPE_TEXT,
tsize, tbuf, true);
+ } else {
+ error_report("vnc: malformed extended clipboard payload "
+ "with text length %u exceeding available %u",
+ tsize, size - 4);
+ vnc_client_error(vs);
+ return;
}
}
}
--
2.47.1
^ permalink raw reply [flat|nested] 16+ messages in thread* [QEMU HCI-8.0 PATCH 07/15] ui/vnc: fix OOB write in vnc_refresh_lossy_rect
2026-09-04 10:11 [QEMU HCI-8.0 PATCH 00/15] VNC stability fixes Andrey Drobyshev
` (5 preceding siblings ...)
2026-09-04 10:11 ` [QEMU HCI-8.0 PATCH 06/15] ui: fix validation of VNC extended clipboard data length Andrey Drobyshev
@ 2026-09-04 10:11 ` Andrey Drobyshev
2026-09-04 10:11 ` [QEMU HCI-8.0 PATCH 08/15] ui/vnc: validate color shifts in SetPixelFormat Andrey Drobyshev
` (7 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Andrey Drobyshev @ 2026-09-04 10:11 UTC (permalink / raw)
To: svt-core; +Cc: andrey.drobyshev, den
From: Marc-André Lureau <marcandre.lureau@redhat.com>
vnc_refresh_lossy_rect() always marks a full VNC_STAT_RECT (64) rows
as dirty when refreshing a lossy tile. When the display height is not
a multiple of VNC_STAT_RECT (e.g. VNC_MAX_HEIGHT = 2160), the bottom
tile is partial -- the last tile at y=2112 has only 48 valid rows.
The unclamped loop writes to vs->dirty[2160..2175], past the end of
the VNC_MAX_HEIGHT-sized array.
Clamp the row count to the actual surface height so partial bottom
tiles only mark valid dirty bitmap entries.
Fixes: CVE-2026-48002
Fixes: 7d964c9d2fc6 ("vnc: refresh lossy rect after a given timeout")
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3950
Reported-by: huntr bubble
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Marc-Andre Lureau <marcandre.lureau@redhat.com>
(cherry picked from commit 3543c2b855cc8cd25a5dbf05564a47ba42f45fad)
---
ui/vnc.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/ui/vnc.c b/ui/vnc.c
index abc83a46e32..859c5df4e52 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -3025,10 +3025,18 @@ static int vnc_refresh_lossy_rect(VncDisplay *vd, int x, int y)
int sty = y / VNC_STAT_RECT;
int stx = x / VNC_STAT_RECT;
int has_dirty = 0;
+ int height = MIN(pixman_image_get_height(vd->guest.fb),
+ pixman_image_get_height(vd->server));
+ int rows;
y = QEMU_ALIGN_DOWN(y, VNC_STAT_RECT);
x = QEMU_ALIGN_DOWN(x, VNC_STAT_RECT);
+ rows = MIN(VNC_STAT_RECT, height - y);
+ if (rows <= 0) {
+ return 0;
+ }
+
QTAILQ_FOREACH(vs, &vd->clients, next) {
VncConnection *vc = container_of(vs, VncConnection, vs);
int j;
@@ -3043,7 +3051,7 @@ static int vnc_refresh_lossy_rect(VncDisplay *vd, int x, int y)
}
vc->worker.lossy_rect[sty][stx] = 0;
- for (j = 0; j < VNC_STAT_RECT; ++j) {
+ for (j = 0; j < rows; ++j) {
bitmap_set(vs->dirty[y + j],
x / VNC_DIRTY_PIXELS_PER_BIT,
VNC_STAT_RECT / VNC_DIRTY_PIXELS_PER_BIT);
--
2.47.1
^ permalink raw reply [flat|nested] 16+ messages in thread* [QEMU HCI-8.0 PATCH 08/15] ui/vnc: validate color shifts in SetPixelFormat
2026-09-04 10:11 [QEMU HCI-8.0 PATCH 00/15] VNC stability fixes Andrey Drobyshev
` (6 preceding siblings ...)
2026-09-04 10:11 ` [QEMU HCI-8.0 PATCH 07/15] ui/vnc: fix OOB write in vnc_refresh_lossy_rect Andrey Drobyshev
@ 2026-09-04 10:11 ` Andrey Drobyshev
2026-09-04 10:11 ` [QEMU HCI-8.0 PATCH 09/15] ui/vnc: use RFB wire types for client message handlers Andrey Drobyshev
` (6 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Andrey Drobyshev @ 2026-09-04 10:11 UTC (permalink / raw)
To: svt-core; +Cc: andrey.drobyshev, den
From: Marc-André Lureau <marcandre.lureau@redhat.com>
A malicious VNC client can send a SetPixelFormat message with shift
values >= 32, causing UB mask computation
(e.g. red_max << red_shift where red_shift is 255). Apparently, this is
not covered by -fwrapv.
Reject color shifts >= bits_per_pixel || 32 before computing masks.
Fixes: 9f64916da20 ("pixman/vnc: use pixman images in vnc.")
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3948
Reported-by: huntr bubble
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Marc-Andre Lureau <marcandre.lureau@redhat.com>
(cherry picked from commit fb71c895d7ff3c68f228095b5e6494e6c23b6a0b)
---
ui/vnc.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/ui/vnc.c b/ui/vnc.c
index 859c5df4e52..a311f74e8b9 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -2293,6 +2293,13 @@ static void set_pixel_format(VncState *vs, int bits_per_pixel,
return;
}
+ if (red_shift >= bits_per_pixel || red_shift >= 32 ||
+ green_shift >= bits_per_pixel || green_shift >= 32 ||
+ blue_shift >= bits_per_pixel || blue_shift >= 32) {
+ vnc_client_error(vs);
+ return;
+ }
+
vs->client_pf.rmax = red_max ? red_max : 0xFF;
vs->client_pf.rbits = ctpopl(red_max);
vs->client_pf.rshift = red_shift;
--
2.47.1
^ permalink raw reply [flat|nested] 16+ messages in thread* [QEMU HCI-8.0 PATCH 09/15] ui/vnc: use RFB wire types for client message handlers
2026-09-04 10:11 [QEMU HCI-8.0 PATCH 00/15] VNC stability fixes Andrey Drobyshev
` (7 preceding siblings ...)
2026-09-04 10:11 ` [QEMU HCI-8.0 PATCH 08/15] ui/vnc: validate color shifts in SetPixelFormat Andrey Drobyshev
@ 2026-09-04 10:11 ` Andrey Drobyshev
2026-09-04 10:12 ` [QEMU HCI-8.0 PATCH 10/15] ui/vnc: fix out-of-bounds write in lossy refresh dirty marking Andrey Drobyshev
` (5 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Andrey Drobyshev @ 2026-09-04 10:11 UTC (permalink / raw)
To: svt-core; +Cc: andrey.drobyshev, den
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Use exact-width unsigned types for the static functions that process
RFB client messages, matching the types returned by read_u8(),
read_u16(), and read_u32():
- set_pixel_format: uint8_t/uint16_t for pixel format fields
- pointer_event: uint8_t button_mask, uint16_t x/y
- key_event/ext_key_event: bool down, uint32_t sym/keycode
- do_key_event: uint32_t sym
- framebuffer_update_request: uint8_t incremental, uint16_t x/y/w/h
Drop needless declarations.
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Marc-Andre Lureau <marcandre.lureau@redhat.com>
(cherry picked from commit 3162692a3b67603e2b01f0c6441daa682acd6164)
---
ui/vnc.c | 39 +++++++++++++++++----------------------
1 file changed, 17 insertions(+), 22 deletions(-)
diff --git a/ui/vnc.c b/ui/vnc.c
index a311f74e8b9..d76a777cc94 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -610,15 +610,7 @@ bool vnc_display_reload_certs(const char *id, Error **errp)
3) resolutions > 1024
*/
-static int vnc_update_client(VncState *vs, int has_dirty);
-static void vnc_disconnect_start(VncState *vs);
-
static void vnc_colordepth(VncState *vs);
-static void framebuffer_update_request(VncState *vs, int incremental,
- int x_position, int y_position,
- int w, int h);
-static void vnc_refresh(DisplayChangeListener *dcl);
-static int vnc_refresh_server_surface(VncDisplay *vd);
static int vnc_width(VncDisplay *vd)
{
@@ -1780,7 +1772,8 @@ static void check_pointer_type_change(Notifier *notifier, void *data)
vs->absolute = absolute;
}
-static void pointer_event(VncState *vs, int button_mask, int x, int y)
+static void pointer_event(VncState *vs, uint8_t button_mask,
+ uint16_t x, uint16_t y)
{
static uint32_t bmap[INPUT_BUTTON__MAX] = {
[INPUT_BUTTON_LEFT] = 0x01,
@@ -1857,7 +1850,7 @@ static void kbd_leds(void *opaque, int ledstate)
}
}
-static void do_key_event(VncState *vs, int down, int keycode, int sym)
+static void do_key_event(VncState *vs, int down, int keycode, uint32_t sym)
{
QKeyCode qcode = qemu_input_key_number_to_qcode(keycode);
@@ -2036,7 +2029,7 @@ static const char *code2name(int keycode)
return QKeyCode_str(qemu_input_key_number_to_qcode(keycode));
}
-static void key_event(VncState *vs, int down, uint32_t sym)
+static void key_event(VncState *vs, bool down, uint32_t sym)
{
int keycode;
int lsym = sym;
@@ -2051,8 +2044,8 @@ static void key_event(VncState *vs, int down, uint32_t sym)
do_key_event(vs, down, keycode, sym);
}
-static void ext_key_event(VncState *vs, int down,
- uint32_t sym, uint16_t keycode)
+static void ext_key_event(VncState *vs, bool down,
+ uint32_t sym, uint32_t keycode)
{
/* if the user specifies a keyboard layout, always use it */
if (keyboard_layout) {
@@ -2063,8 +2056,9 @@ static void ext_key_event(VncState *vs, int down,
}
}
-static void framebuffer_update_request(VncState *vs, int incremental,
- int x, int y, int w, int h)
+static void framebuffer_update_request(VncState *vs, uint8_t incremental,
+ uint16_t x, uint16_t y,
+ uint16_t w, uint16_t h)
{
if (incremental) {
if (vs->update != VNC_STATE_UPDATE_FORCE) {
@@ -2267,10 +2261,11 @@ static void send_color_map(VncState *vs)
vnc_unlock_output(vs);
}
-static void set_pixel_format(VncState *vs, int bits_per_pixel,
- int big_endian_flag, int true_color_flag,
- int red_max, int green_max, int blue_max,
- int red_shift, int green_shift, int blue_shift)
+static void set_pixel_format(VncState *vs, uint8_t bits_per_pixel,
+ uint8_t big_endian_flag, uint8_t true_color_flag,
+ uint16_t red_max, uint16_t green_max,
+ uint16_t blue_max, uint8_t red_shift,
+ uint8_t green_shift, uint8_t blue_shift)
{
if (!true_color_flag) {
/* Expose a reasonable default 256 color map */
@@ -2303,15 +2298,15 @@ static void set_pixel_format(VncState *vs, int bits_per_pixel,
vs->client_pf.rmax = red_max ? red_max : 0xFF;
vs->client_pf.rbits = ctpopl(red_max);
vs->client_pf.rshift = red_shift;
- vs->client_pf.rmask = red_max << red_shift;
+ vs->client_pf.rmask = (uint32_t)red_max << red_shift;
vs->client_pf.gmax = green_max ? green_max : 0xFF;
vs->client_pf.gbits = ctpopl(green_max);
vs->client_pf.gshift = green_shift;
- vs->client_pf.gmask = green_max << green_shift;
+ vs->client_pf.gmask = (uint32_t)green_max << green_shift;
vs->client_pf.bmax = blue_max ? blue_max : 0xFF;
vs->client_pf.bbits = ctpopl(blue_max);
vs->client_pf.bshift = blue_shift;
- vs->client_pf.bmask = blue_max << blue_shift;
+ vs->client_pf.bmask = (uint32_t)blue_max << blue_shift;
vs->client_pf.bits_per_pixel = bits_per_pixel;
vs->client_pf.bytes_per_pixel = bits_per_pixel / 8;
vs->client_pf.depth = bits_per_pixel == 32 ? 24 : bits_per_pixel;
--
2.47.1
^ permalink raw reply [flat|nested] 16+ messages in thread* [QEMU HCI-8.0 PATCH 10/15] ui/vnc: fix out-of-bounds write in lossy refresh dirty marking
2026-09-04 10:11 [QEMU HCI-8.0 PATCH 00/15] VNC stability fixes Andrey Drobyshev
` (8 preceding siblings ...)
2026-09-04 10:11 ` [QEMU HCI-8.0 PATCH 09/15] ui/vnc: use RFB wire types for client message handlers Andrey Drobyshev
@ 2026-09-04 10:12 ` Andrey Drobyshev
2026-09-04 10:12 ` [QEMU HCI-8.0 PATCH 11/15] ui/vnc: validate SetPixelFormat field ranges Andrey Drobyshev
` (4 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Andrey Drobyshev @ 2026-09-04 10:12 UTC (permalink / raw)
To: svt-core; +Cc: andrey.drobyshev, den
From: Marc-André Lureau <marcandre.lureau@redhat.com>
vnc_refresh_lossy_rect() marks a full VNC_STAT_RECT (64) rows of the
dirty bitmap when refreshing a lossy tile. When the display height is
not a multiple of VNC_STAT_RECT, the last tile row is a partial tile and
the loop writes past the end of vs->dirty[VNC_MAX_HEIGHT].
For example, with a 2160-pixel-high display (VNC_MAX_HEIGHT), the last
stat tile starts at y=2112. The unconditional 64-row loop writes rows
2112..2175, overflowing 16 rows (640 bytes) past the dirty bitmap into
subsequent VncState fields.
Fix by passing the effective display height into
vnc_refresh_lossy_rect() and clamping the inner loop.
Fixes: CVE-2026-61475
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3935
Reported-by: "Vulnerability Report" <vr@darknavy.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Marc-Andre Lureau <marcandre.lureau@redhat.com>
(cherry picked from commit e650e4fe0fb35b7a8ec9fc04e00346c02640bd58)
---
ui/vnc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/ui/vnc.c b/ui/vnc.c
index d76a777cc94..40b4e7077da 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -3021,18 +3021,18 @@ void vnc_sent_lossy_rect(VncWorker *worker, int x, int y, int w, int h)
}
}
-static int vnc_refresh_lossy_rect(VncDisplay *vd, int x, int y)
+static int vnc_refresh_lossy_rect(VncDisplay *vd, int x, int y,
+ int height)
{
VncState *vs;
int sty = y / VNC_STAT_RECT;
int stx = x / VNC_STAT_RECT;
int has_dirty = 0;
- int height = MIN(pixman_image_get_height(vd->guest.fb),
- pixman_image_get_height(vd->server));
int rows;
y = QEMU_ALIGN_DOWN(y, VNC_STAT_RECT);
x = QEMU_ALIGN_DOWN(x, VNC_STAT_RECT);
+ rows = MIN(VNC_STAT_RECT, height - y);
rows = MIN(VNC_STAT_RECT, height - y);
if (rows <= 0) {
@@ -3104,7 +3104,7 @@ static int vnc_update_stats(VncDisplay *vd, struct timeval * tv)
if (timercmp(&res, &VNC_REFRESH_LOSSY, >)) {
rect->freq = 0;
- has_dirty += vnc_refresh_lossy_rect(vd, x, y);
+ has_dirty += vnc_refresh_lossy_rect(vd, x, y, height);
memset(rect->times, 0, sizeof (rect->times));
continue ;
}
--
2.47.1
^ permalink raw reply [flat|nested] 16+ messages in thread* [QEMU HCI-8.0 PATCH 11/15] ui/vnc: validate SetPixelFormat field ranges
2026-09-04 10:11 [QEMU HCI-8.0 PATCH 00/15] VNC stability fixes Andrey Drobyshev
` (9 preceding siblings ...)
2026-09-04 10:12 ` [QEMU HCI-8.0 PATCH 10/15] ui/vnc: fix out-of-bounds write in lossy refresh dirty marking Andrey Drobyshev
@ 2026-09-04 10:12 ` Andrey Drobyshev
2026-09-04 10:12 ` [QEMU HCI-8.0 PATCH 12/15] ui/vnc: remove redundant rows computation Andrey Drobyshev
` (3 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Andrey Drobyshev @ 2026-09-04 10:12 UTC (permalink / raw)
To: svt-core; +Cc: andrey.drobyshev, den
From: Marc-André Lureau <marcandre.lureau@redhat.com>
The VNC SetPixelFormat message carries red/green/blue_max as 16-bit
values, but PixelFormat stores them as uint8_t. A client sending a
max value above 255 (e.g. 0x0100) passes the existing non-zero check
but silently truncates to 0 on assignment, leading to a division by
zero in the Tight PNG palette path.
Add explicit range checks if any channel max exceeds UINT8_MAX.
Fixes: CVE-2026-15578
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3976
Reported-by: dong ling
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-Andre Lureau <marcandre.lureau@redhat.com>
(cherry picked from commit 6075444c5a72ab531295d92050d95cebea8a8119)
---
ui/vnc.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/ui/vnc.c b/ui/vnc.c
index 40b4e7077da..5e06e079e45 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -2288,6 +2288,11 @@ static void set_pixel_format(VncState *vs, uint8_t bits_per_pixel,
return;
}
+ if (red_max > UINT8_MAX || green_max > UINT8_MAX || blue_max > UINT8_MAX) {
+ vnc_client_error(vs);
+ return;
+ }
+
if (red_shift >= bits_per_pixel || red_shift >= 32 ||
green_shift >= bits_per_pixel || green_shift >= 32 ||
blue_shift >= bits_per_pixel || blue_shift >= 32) {
--
2.47.1
^ permalink raw reply [flat|nested] 16+ messages in thread* [QEMU HCI-8.0 PATCH 12/15] ui/vnc: remove redundant rows computation
2026-09-04 10:11 [QEMU HCI-8.0 PATCH 00/15] VNC stability fixes Andrey Drobyshev
` (10 preceding siblings ...)
2026-09-04 10:12 ` [QEMU HCI-8.0 PATCH 11/15] ui/vnc: validate SetPixelFormat field ranges Andrey Drobyshev
@ 2026-09-04 10:12 ` Andrey Drobyshev
2026-09-04 10:12 ` [QEMU HCI-8.0 PATCH 13/15] ui/vnc: Fix crash when specifying [vnc] without id in the config file Andrey Drobyshev
` (2 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Andrey Drobyshev @ 2026-09-04 10:12 UTC (permalink / raw)
To: svt-core; +Cc: andrey.drobyshev, den
From: Marc-André Lureau <marcandre.lureau@redhat.com>
"rows" was already computed in an earlier commit 3543c2b855 ("ui/vnc:
fix OOB write in vnc_refresh_lossy_rect").
Fixes: e650e4fe0f ("ui/vnc: fix out-of-bounds write in lossy refresh dirty marking")
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
(cherry picked from commit efa7244b2a0bd5e40ec334dbec4a09af0134d91f)
---
ui/vnc.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/ui/vnc.c b/ui/vnc.c
index 5e06e079e45..6c4132b8dbc 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -3037,7 +3037,6 @@ static int vnc_refresh_lossy_rect(VncDisplay *vd, int x, int y,
y = QEMU_ALIGN_DOWN(y, VNC_STAT_RECT);
x = QEMU_ALIGN_DOWN(x, VNC_STAT_RECT);
- rows = MIN(VNC_STAT_RECT, height - y);
rows = MIN(VNC_STAT_RECT, height - y);
if (rows <= 0) {
--
2.47.1
^ permalink raw reply [flat|nested] 16+ messages in thread* [QEMU HCI-8.0 PATCH 13/15] ui/vnc: Fix crash when specifying [vnc] without id in the config file
2026-09-04 10:11 [QEMU HCI-8.0 PATCH 00/15] VNC stability fixes Andrey Drobyshev
` (11 preceding siblings ...)
2026-09-04 10:12 ` [QEMU HCI-8.0 PATCH 12/15] ui/vnc: remove redundant rows computation Andrey Drobyshev
@ 2026-09-04 10:12 ` Andrey Drobyshev
2026-09-04 10:12 ` [QEMU HCI-8.0 PATCH 14/15] ui/vnc: Fix qemu abort when query vnc info Andrey Drobyshev
2026-09-04 10:12 ` [QEMU HCI-8.0 PATCH 15/15] ui/spice: fix crash when disabling GL scanout on Andrey Drobyshev
14 siblings, 0 replies; 16+ messages in thread
From: Andrey Drobyshev @ 2026-09-04 10:12 UTC (permalink / raw)
To: svt-core; +Cc: andrey.drobyshev, den
From: Thomas Huth <thuth@redhat.com>
QEMU currently crashes when there is a [vnc] section in the config
file that does not have an "id = ..." line:
$ echo "[vnc]" > /tmp/qemu.conf
$ ./qemu-system-x86_64 -readconfig /tmp/qemu.conf
qemu-system-x86_64: ../../devel/qemu/ui/vnc.c:4347: vnc_init_func:
Assertion `id' failed.
Aborted (core dumped)
The required "id" is only set up automatically while parsing the command
line, but not when reading the options from the config file.
Thus let's move code that automatically adds the id (if it does not
exist yet) to the init function that needs the id for the first time,
replacing the assert() statement there.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2836
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20250821145130.845104-1-thuth@redhat.com>
(cherry picked from commit 38dd513263d814dc3cf554b899c118a46ca77577)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit 571a7414e7031e1b646250b904f7babe1e8c526f)
---
ui/vnc.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/ui/vnc.c b/ui/vnc.c
index 6c4132b8dbc..016a3b0eb45 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -4327,8 +4327,9 @@ void vnc_display_add_client(const char *id, int csock, bool skipauth)
}
}
-static void vnc_auto_assign_id(QemuOptsList *olist, QemuOpts *opts)
+static char *vnc_auto_assign_id(QemuOpts *opts)
{
+ QemuOptsList *olist = qemu_find_opts("vnc");
int i = 2;
char *id;
@@ -4338,23 +4339,18 @@ static void vnc_auto_assign_id(QemuOptsList *olist, QemuOpts *opts)
id = g_strdup_printf("vnc%d", i++);
}
qemu_opts_set_id(opts, id);
+
+ return id;
}
void vnc_parse(const char *str)
{
QemuOptsList *olist = qemu_find_opts("vnc");
QemuOpts *opts = qemu_opts_parse_noisily(olist, str, !is_help_option(str));
- const char *id;
if (!opts) {
exit(1);
}
-
- id = qemu_opts_id(opts);
- if (!id) {
- /* auto-assign id if not present */
- vnc_auto_assign_id(olist, opts);
- }
}
int vnc_init_func(void *opaque, QemuOpts *opts, Error **errp)
@@ -4362,7 +4358,11 @@ int vnc_init_func(void *opaque, QemuOpts *opts, Error **errp)
Error *local_err = NULL;
char *id = (char *)qemu_opts_id(opts);
- assert(id);
+ if (!id) {
+ /* auto-assign id if not present */
+ id = vnc_auto_assign_id(opts);
+ }
+
vnc_display_init(id, &local_err);
if (local_err) {
error_propagate(errp, local_err);
--
2.47.1
^ permalink raw reply [flat|nested] 16+ messages in thread* [QEMU HCI-8.0 PATCH 14/15] ui/vnc: Fix qemu abort when query vnc info
2026-09-04 10:11 [QEMU HCI-8.0 PATCH 00/15] VNC stability fixes Andrey Drobyshev
` (12 preceding siblings ...)
2026-09-04 10:12 ` [QEMU HCI-8.0 PATCH 13/15] ui/vnc: Fix crash when specifying [vnc] without id in the config file Andrey Drobyshev
@ 2026-09-04 10:12 ` Andrey Drobyshev
2026-09-04 10:12 ` [QEMU HCI-8.0 PATCH 15/15] ui/spice: fix crash when disabling GL scanout on Andrey Drobyshev
14 siblings, 0 replies; 16+ messages in thread
From: Andrey Drobyshev @ 2026-09-04 10:12 UTC (permalink / raw)
To: svt-core; +Cc: andrey.drobyshev, den
From: "AlanoSong@163.com" <AlanoSong@163.com>
When there is no display device on qemu machine,
and user only access qemu by remote vnc.
At the same time user input `info vnc` by QMP,
the qemu will abort.
To avoid the abort above, I add display device check,
when query vnc info in qmp_query_vnc_servers().
Reviewed-by: Marc-AndréLureau <marcandre.lureau@redhat.com>
Signed-off-by: Alano Song <AlanoSong@163.com>
[ Marc-André - removed useless Error *err ]
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20251125131955.7024-1-AlanoSong@163.com>
(cherry picked from commit 4c1646e23f761e3dc6d88c8995f13be8f668a012)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit 13aae93f72f304235d46950b05e71b3267456771)
---
ui/vnc.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/ui/vnc.c b/ui/vnc.c
index 016a3b0eb45..b9369dbe21c 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -555,9 +555,12 @@ VncInfo2List *qmp_query_vnc_servers(Error **errp)
qmp_query_auth(vd->auth, vd->subauth, &info->auth,
&info->vencrypt, &info->has_vencrypt);
if (vd->dcl.con) {
- dev = DEVICE(object_property_get_link(OBJECT(vd->dcl.con),
- "device", &error_abort));
- info->display = g_strdup(dev->id);
+ Object *obj = object_property_get_link(OBJECT(vd->dcl.con),
+ "device", NULL);
+ if (obj) {
+ dev = DEVICE(obj);
+ info->display = g_strdup(dev->id);
+ }
}
for (i = 0; vd->listener != NULL && i < vd->listener->nsioc; i++) {
info->server = qmp_query_server_entry(
--
2.47.1
^ permalink raw reply [flat|nested] 16+ messages in thread* [QEMU HCI-8.0 PATCH 15/15] ui/spice: fix crash when disabling GL scanout on
2026-09-04 10:11 [QEMU HCI-8.0 PATCH 00/15] VNC stability fixes Andrey Drobyshev
` (13 preceding siblings ...)
2026-09-04 10:12 ` [QEMU HCI-8.0 PATCH 14/15] ui/vnc: Fix qemu abort when query vnc info Andrey Drobyshev
@ 2026-09-04 10:12 ` Andrey Drobyshev
14 siblings, 0 replies; 16+ messages in thread
From: Andrey Drobyshev @ 2026-09-04 10:12 UTC (permalink / raw)
To: svt-core; +Cc: andrey.drobyshev, den
From: Marc-André Lureau <marcandre.lureau@redhat.com>
When spice_qxl_gl_scanout2() isn't available, the fallback code
incorrectly handles NULL arguments to disable the scanout, leading to:
Program terminated with signal SIGSEGV, Segmentation fault.
#0 spice_server_gl_scanout (qxl=0x55a25ce57ae8, fd=0x0, width=0, height=0, offset=0x0, stride=0x0, num_planes=0, format=0, modifier=72057594037927935, y_0_top=0)
at ../ui/spice-display.c:983
983 if (num_planes <= 1) {
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2391334
Fixes: 98a050ca93afd8 ("ui/spice: support multi plane dmabuf scanout")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Message-Id: <20250903193818.2460914-1-marcandre.lureau@redhat.com>
(cherry picked from commit 62fd247a24290dba2b2de4ee8575624a7993973c)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit ecc1aef81eafa53b7267fb4d93aaf2eb6a1e3d5a)
---
ui/spice-display.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/ui/spice-display.c b/ui/spice-display.c
index 669832c5612..db71e866f89 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -980,7 +980,9 @@ static void spice_server_gl_scanout(QXLInstance *qxl,
spice_qxl_gl_scanout2(qxl, fd, width, height, offset, stride,
num_planes, format, modifier, y_0_top);
#else
- if (num_planes <= 1) {
+ if (fd == NULL) {
+ spice_qxl_gl_scanout(qxl, -1, 0, 0, 0, 0, false);
+ } else if (num_planes <= 1) {
spice_qxl_gl_scanout(qxl, fd[0], width, height, stride[0], format, y_0_top);
} else {
error_report("SPICE server does not support multi plane GL scanout");
--
2.47.1
^ permalink raw reply [flat|nested] 16+ messages in thread