Received: from eggs.gnu.org ([2001:4830:134:3::10]:59430) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjitS-0005jO-RP for qemu-devel@nongnu.org; Tue, 13 Sep 2016 04:16:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjitR-0007pH-Nh for qemu-devel@nongnu.org; Tue, 13 Sep 2016 04:16:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49642) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjitR-0007ol-HW for qemu-devel@nongnu.org; Tue, 13 Sep 2016 04:16:37 -0400 From: Gerd Hoffmann Date: Tue, 13 Sep 2016 10:16:31 +0200 Message-Id: <1473754593-13527-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1473754593-13527-1-git-send-email-kraxel@redhat.com> References: <1473754593-13527-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PULL 1/3] vmsvga: correct bitmap and pixmap size checks List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Prasad J Pandit , Gerd Hoffmann From: Prasad J Pandit When processing svga command DEFINE_CURSOR in vmsvga_fifo_run, the computed BITMAP and PIXMAP size are checked against the 'cursor.mask[]' and 'cursor.image[]' array sizes in bytes. Correct these checks to avoid OOB memory access. Reported-by: Qinghao Tang Reported-by: Li Qiang Signed-off-by: Prasad J Pandit Message-id: 1473338754-15430-1-git-send-email-ppandit@redhat.com Signed-off-by: Gerd Hoffmann --- hw/display/vmware_vga.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index e51a05e..6599cf0 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -676,11 +676,13 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s) cursor.bpp = vmsvga_fifo_read(s); args = SVGA_BITMAP_SIZE(x, y) + SVGA_PIXMAP_SIZE(x, y, cursor.bpp); - if (cursor.width > 256 || - cursor.height > 256 || - cursor.bpp > 32 || - SVGA_BITMAP_SIZE(x, y) > sizeof cursor.mask || - SVGA_PIXMAP_SIZE(x, y, cursor.bpp) > sizeof cursor.image) { + if (cursor.width > 256 + || cursor.height > 256 + || cursor.bpp > 32 + || SVGA_BITMAP_SIZE(x, y) + > sizeof(cursor.mask) / sizeof(cursor.mask[0]) + || SVGA_PIXMAP_SIZE(x, y, cursor.bpp) + > sizeof(cursor.image) / sizeof(cursor.image[0])) { goto badcmd; } -- 1.8.3.1