qemu/qemu/24767bcf0fdcd19415cb07c06f637ea29a5cebbb ui/vnc: fix out-of-bounds write in lossy refresh dirty marking
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)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
1 file changed