qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] display: vga: add check to limit display width


From: P J P
Subject: [Qemu-devel] [PATCH] display: vga: add check to limit display width
Date: Tue, 26 Apr 2016 13:37:38 +0530

From: Prasad J Pandit <address@hidden>

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 <address@hidden>
Signed-off-by: Prasad J Pandit <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]