thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
9ae3a8
From e47337aa12a371cded61aefee052a808d32e0d64 Mon Sep 17 00:00:00 2001
9ae3a8
From: Gerd Hoffmann <kraxel@redhat.com>
9ae3a8
Date: Mon, 9 Apr 2018 13:27:36 +0200
9ae3a8
Subject: [PATCH 02/10] vga: fix region calculation
9ae3a8
9ae3a8
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
9ae3a8
Message-id: <20180409132736.24598-3-kraxel@redhat.com>
9ae3a8
Patchwork-id: 79512
9ae3a8
O-Subject: [RHEL-7.5 qemu-kvm PATCH 2/2] vga: fix region calculation
9ae3a8
Bugzilla: 1553670
9ae3a8
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
9ae3a8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
RH-Acked-by: John Snow <jsnow@redhat.com>
9ae3a8
9ae3a8
Typically the scanline length and the line offset are identical.  But
9ae3a8
in case they are not our calculation for region_end is incorrect.  Using
9ae3a8
line_offset is fine for all scanlines, except the last one where we have
9ae3a8
to use the actual scanline length.
9ae3a8
9ae3a8
Fixes: CVE-2018-7550
9ae3a8
Reported-by: Ross Lagerwall <ross.lagerwall@citrix.com>
9ae3a8
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9ae3a8
Reviewed-by: Prasad J Pandit <pjp@fedoraproject.org>
9ae3a8
Tested-by: Ross Lagerwall <ross.lagerwall@citrix.com>
9ae3a8
Message-id: 20180309143704.13420-1-kraxel@redhat.com
9ae3a8
(cherry picked from commit 7cdc61becd095b64a786b2625f321624e7111f3d)
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 hw/display/vga.c | 2 ++
9ae3a8
 1 file changed, 2 insertions(+)
9ae3a8
9ae3a8
diff --git a/hw/display/vga.c b/hw/display/vga.c
9ae3a8
index 8e6c6d6..9270a75 100644
9ae3a8
--- a/hw/display/vga.c
9ae3a8
+++ b/hw/display/vga.c
9ae3a8
@@ -1535,6 +1535,8 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)
9ae3a8
 
9ae3a8
     region_start = (s->start_addr * 4);
9ae3a8
     region_end = region_start + (ram_addr_t)s->line_offset * height;
9ae3a8
+    region_end += width * s->get_bpp(s) / 8; /* scanline length */
9ae3a8
+    region_end -= s->line_offset;
9ae3a8
     if (region_end > s->vbe_size) {
9ae3a8
         /* wraps around (can happen with cirrus vbe modes) */
9ae3a8
         region_start = 0;
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8