qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] display: vga: add check to limit display width
@ 2016-04-26  8:07 P J P
  0 siblings, 0 replies; only message in thread
From: P J P @ 2016-04-26  8:07 UTC (permalink / raw)
  To: Qemu Developers; +Cc: Gerd Hoffmann, zuozhi.fzz, Prasad J Pandit

From: Prasad J Pandit <pjp@fedoraproject.org>

In vga_draw_graphic, display width could exceed the maximum
range of VBE_DISPI_MAX_XRES(16000). This could lead to possible
integer overflows. Add check to avoid it.

Reported-by: Zuozhi Fzz <zuozhi.fzz@alibaba-inc.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
---
 hw/display/vga.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/display/vga.c b/hw/display/vga.c
index 9f68394..1a66291 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -1478,6 +1478,9 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)
             disp_width <<= 1;
         }
     }
+    if (disp_width > VBE_DISPI_MAX_XRES) {
+        disp_width = VBE_DISPI_MAX_XRES;
+    }
 
     depth = s->get_bpp(s);
 
-- 
2.5.5

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-04-26  8:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-26  8:07 [Qemu-devel] [PATCH] display: vga: add check to limit display width P J P

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).