From: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
To: svt-core@virtuozzo.com
Cc: andrey.drobyshev@virtuozzo.com, den@openvz.org
Subject: [QEMU HCI-8.0 PATCH 10/15] ui/vnc: fix out-of-bounds write in lossy refresh dirty marking
Date: Fri, 4 Sep 2026 13:12:00 +0300 [thread overview]
Message-ID: <20260904101206.701978-11-andrey.drobyshev@virtuozzo.com> (raw)
In-Reply-To: <20260904101206.701978-1-andrey.drobyshev@virtuozzo.com>
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
next prev parent reply other threads:[~2026-09-04 10:12 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` [QEMU HCI-8.0 PATCH 03/15] ui/vnc: fix OOB write in VNC stats array 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
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 ` [QEMU HCI-8.0 PATCH 06/15] ui: fix validation of VNC extended clipboard data length 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
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 ` [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 [this message]
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 ` [QEMU HCI-8.0 PATCH 12/15] ui/vnc: remove redundant rows computation 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
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260904101206.701978-11-andrey.drobyshev@virtuozzo.com \
--to=andrey.drobyshev@virtuozzo.com \
--cc=den@openvz.org \
--cc=svt-core@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox