695a56c
------------------------------------------------------------------------
695a56c
*From*: 	P J P
695a56c
*Subject*: 	[Qemu-devel] [PATCH] display: vga: add check to limit
695a56c
display width
695a56c
*Date*: 	Tue, 26 Apr 2016 13:37:38 +0530
695a56c
695a56c
------------------------------------------------------------------------
695a56c
695a56c
From: Prasad J Pandit <address@hidden>
695a56c
695a56c
In vga_draw_graphic, display width could exceed the maximum
695a56c
range of VBE_DISPI_MAX_XRES(16000). This could lead to possible
695a56c
integer overflows. Add check to avoid it.
695a56c
695a56c
Reported-by: Zuozhi Fzz <address@hidden>
695a56c
Signed-off-by: Prasad J Pandit <address@hidden>
695a56c
---
695a56c
 tools/qemu-xen/hw/display/vga.c | 3 +++
695a56c
 1 file changed, 3 insertions(+)
695a56c
695a56c
diff --git a/tools/qemu-xen/hw/display/vga.c b/tools/qemu-xen/hw/display/vga.c
695a56c
index 9f68394..1a66291 100644
695a56c
--- a/tools/qemu-xen/hw/display/vga.c
695a56c
+++ b/tools/qemu-xen/hw/display/vga.c
695a56c
@@ -1478,6 +1478,9 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)
695a56c
             disp_width <<= 1;
695a56c
         }
695a56c
     }
695a56c
+    if (disp_width > VBE_DISPI_MAX_XRES) {
695a56c
+        disp_width = VBE_DISPI_MAX_XRES;
695a56c
+    }
695a56c
 
695a56c
     depth = s->get_bpp(s);
e2943f8
 
695a56c
-- 
695a56c
2.5.5
695a56c