yeahuh / rpms / qemu-kvm

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