summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlu zhipeng2022-09-29 14:23:52 +0200
committerGerd Hoffmann2022-10-12 11:00:55 +0200
commit2fba4e9c4938406fa676bfd3566e416e095cf93a (patch)
tree61d5a710a3c0e72034e970d475229e1dc680b94c
parentui/gtk-egl: egl context needs to be unbound in the end of gd_egl_switch (diff)
downloadqemu-2fba4e9c4938406fa676bfd3566e416e095cf93a.tar.gz
qemu-2fba4e9c4938406fa676bfd3566e416e095cf93a.tar.xz
qemu-2fba4e9c4938406fa676bfd3566e416e095cf93a.zip
cirrus_vga: fix potential memory overflow
Signed-off-by: lu zhipeng <luzhipeng@cestc.cn> Message-Id: <20220929122352.1891-1-luzhipeng@cestc.cn> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r--hw/display/cirrus_vga.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
index 3bb6a58698..2577005d03 100644
--- a/hw/display/cirrus_vga.c
+++ b/hw/display/cirrus_vga.c
@@ -834,7 +834,7 @@ static void cirrus_bitblt_cputovideo_next(CirrusVGAState * s)
word alignment, so we keep them for the next line */
/* XXX: keep alignment to speed up transfer */
end_ptr = s->cirrus_bltbuf + s->cirrus_blt_srcpitch;
- copy_count = s->cirrus_srcptr_end - end_ptr;
+ copy_count = MIN(s->cirrus_srcptr_end - end_ptr, CIRRUS_BLTBUFSIZE);
memmove(s->cirrus_bltbuf, end_ptr, copy_count);
s->cirrus_srcptr = s->cirrus_bltbuf + copy_count;
s->cirrus_srcptr_end = s->cirrus_bltbuf + s->cirrus_blt_srcpitch;