Received: from eggs.gnu.org ([2001:4830:134:3::10]:42270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1auy29-0008K8-6h for qemu-devel@nongnu.org; Tue, 26 Apr 2016 04:07:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1auy26-0001HQ-1U for qemu-devel@nongnu.org; Tue, 26 Apr 2016 04:07:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42225) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1auy25-0001HF-S9 for qemu-devel@nongnu.org; Tue, 26 Apr 2016 04:07:45 -0400 From: P J P Date: Tue, 26 Apr 2016 13:37:38 +0530 Message-Id: <1461658058-1672-1-git-send-email-ppandit@redhat.com> Subject: [Qemu-devel] [PATCH] display: vga: add check to limit display width List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Qemu Developers Cc: Gerd Hoffmann , zuozhi.fzz@alibaba-inc.com, Prasad J Pandit From: Prasad J Pandit 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 Signed-off-by: Prasad J Pandit --- 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