]> git.ipfire.org Git - thirdparty/qemu.git/commit
ui/vnc: fix OOB write in vnc_refresh_lossy_rect
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Mon, 6 Jul 2026 08:45:31 +0000 (12:45 +0400)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Fri, 17 Jul 2026 11:52:31 +0000 (15:52 +0400)
commit3543c2b855cc8cd25a5dbf05564a47ba42f45fad
tree58b515a621cc93f9d4344e8db1b27bfe7d252ae9
parent40cdadfefda3b930a64e5db0aae220bd00ce4ea7
ui/vnc: fix OOB write in vnc_refresh_lossy_rect

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>
ui/vnc.c