From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: qemu-devel@nongnu.org
Subject: [GIT PULL 07/15] ui/vnc: fix out-of-bounds write in lossy refresh dirty marking
Date: Fri, 17 Jul 2026 15:52:46 +0400 [thread overview]
Message-ID: <20260717-fix-v1-7-cb9f7d49dc52@redhat.com> (raw)
In-Reply-To: <20260717-fix-v1-0-cb9f7d49dc52@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>
---
ui/vnc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/ui/vnc.c b/ui/vnc.c
index 8d91cee4d9f..c957731877f 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -3000,18 +3000,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) {
@@ -3083,7 +3083,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.55.0
next prev parent reply other threads:[~2026-07-17 11:54 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-17 11:52 [GIT PULL 00/15] Various UI/security-related fixes for 11.1 Marc-André Lureau
2026-07-17 11:52 ` [GIT PULL 01/15] i386/tdx: fix uninitialized variable warning in tdx_check_features Marc-André Lureau
2026-07-17 11:52 ` [GIT PULL 02/15] ui/vnc: fix OOB write in vnc_refresh_lossy_rect Marc-André Lureau
2026-07-17 11:52 ` [GIT PULL 03/15] ui/vnc: validate color shifts in SetPixelFormat Marc-André Lureau
2026-07-17 11:52 ` [GIT PULL 04/15] ui/vnc: use RFB wire types for client message handlers Marc-André Lureau
2026-07-17 11:52 ` [GIT PULL 05/15] ui/input-barrier: fix off-by-one in keycode bounds check Marc-André Lureau
2026-07-17 11:52 ` [GIT PULL 06/15] ui/gtk: Narrow DMA-BUF critical section Marc-André Lureau
2026-07-17 11:52 ` Marc-André Lureau [this message]
2026-07-21 8:17 ` [GIT PULL 07/15] ui/vnc: fix out-of-bounds write in lossy refresh dirty marking Peter Maydell
2026-07-21 8:23 ` Marc-André Lureau
2026-07-21 8:34 ` Peter Maydell
2026-07-17 11:52 ` [GIT PULL 08/15] ui/vnc: validate SetPixelFormat field ranges Marc-André Lureau
2026-07-17 11:52 ` [GIT PULL 09/15] hw/display/virtio-gpu: fix dmabuf_fd leak on remap failure Marc-André Lureau
2026-07-17 11:52 ` [GIT PULL 10/15] hw/display/qxl: fix TOCTOU in cursor chunk data_size handling Marc-André Lureau
2026-07-17 11:52 ` [GIT PULL 11/15] hw/display/virtio-gpu: validate stride against width on scanout Marc-André Lureau
2026-07-17 11:52 ` [GIT PULL 12/15] hw/display/virtio-gpu: cap submit_3d command buffer allocation Marc-André Lureau
2026-07-17 11:52 ` [GIT PULL 13/15] hw/display/virtio-gpu: handle migration iov allocation failure Marc-André Lureau
2026-07-17 11:52 ` [GIT PULL 14/15] hw/display/virtio-gpu: reject strides exceeding INT_MAX Marc-André Lureau
2026-07-17 11:52 ` [GIT PULL 15/15] hw/display/virtio-gpu: Check pixman_image_create_bits() results Marc-André Lureau
2026-07-19 7:31 ` [GIT PULL 00/15] Various UI/security-related fixes for 11.1 Michael Tokarev
2026-07-19 7:33 ` Michael Tokarev
2026-07-19 7:50 ` Akihiko Odaki
2026-07-19 8:07 ` Marc-André Lureau
2026-07-19 11:41 ` Akihiko Odaki
2026-07-20 9:59 ` Stefan Hajnoczi
2026-07-20 11:27 ` Michael Tokarev
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=20260717-fix-v1-7-cb9f7d49dc52@redhat.com \
--to=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.