qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cirrus_vga: fix potential memory overflow
@ 2022-09-29 12:23 luzhipeng
  2022-10-12  9:01 ` Gerd Hoffmann
  0 siblings, 1 reply; 2+ messages in thread
From: luzhipeng @ 2022-09-29 12:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, lu zhipeng

From: lu zhipeng <luzhipeng@cestc.cn>

Signed-off-by: lu zhipeng <luzhipeng@cestc.cn>
---
 hw/display/cirrus_vga.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
-- 
2.31.1





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cirrus_vga: fix potential memory overflow
  2022-09-29 12:23 [PATCH] cirrus_vga: fix potential memory overflow luzhipeng
@ 2022-10-12  9:01 ` Gerd Hoffmann
  0 siblings, 0 replies; 2+ messages in thread
From: Gerd Hoffmann @ 2022-10-12  9:01 UTC (permalink / raw)
  To: luzhipeng; +Cc: qemu-devel

On Thu, Sep 29, 2022 at 08:23:52PM +0800, luzhipeng wrote:
> From: lu zhipeng <luzhipeng@cestc.cn>
> 
> Signed-off-by: lu zhipeng <luzhipeng@cestc.cn>

> -                copy_count = s->cirrus_srcptr_end - end_ptr;
> +                copy_count = MIN(s->cirrus_srcptr_end - end_ptr, CIRRUS_BLTBUFSIZE);

Added to patch queue.

thanks,
  Gerd



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-12  9:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-29 12:23 [PATCH] cirrus_vga: fix potential memory overflow luzhipeng
2022-10-12  9:01 ` Gerd Hoffmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).