958e1b
From b990e99b42e638a5719cf1cdc2881a6467886fcf Mon Sep 17 00:00:00 2001
958e1b
From: Gerd Hoffmann <kraxel@redhat.com>
958e1b
Date: Wed, 3 Dec 2014 09:17:56 +0100
958e1b
Subject: [PATCH 3/3] cirrus: don't overflow CirrusVGAState->cirrus_bltbuf
958e1b
958e1b
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
958e1b
Message-id: <1417594676-5663-3-git-send-email-kraxel@redhat.com>
958e1b
O-Subject: [RHEL-7.1 qemu-kvm PATCH 2/2] cirrus: don't overflow CirrusVGAState->cirrus_bltbuf
958e1b
Bugzilla: 1169456
958e1b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
958e1b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
958e1b
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
958e1b
958e1b
This is CVE-2014-8106.
958e1b
958e1b
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
958e1b
(cherry picked from commit bf25983345ca44aec3dd92c57142be45452bd38a)
958e1b
---
958e1b
 hw/display/cirrus_vga.c | 4 ++++
958e1b
 1 file changed, 4 insertions(+)
958e1b
958e1b
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
958e1b
index 9ae8313..717ecdb 100644
958e1b
--- a/hw/display/cirrus_vga.c
958e1b
+++ b/hw/display/cirrus_vga.c
958e1b
@@ -292,6 +292,10 @@ static bool blit_is_unsafe(struct CirrusVGAState *s)
958e1b
     assert(s->cirrus_blt_width > 0);
958e1b
     assert(s->cirrus_blt_height > 0);
958e1b
 
958e1b
+    if (s->cirrus_blt_width > CIRRUS_BLTBUFSIZE) {
958e1b
+        return true;
958e1b
+    }
958e1b
+
958e1b
     if (blit_region_is_unsafe(s, s->cirrus_blt_dstpitch,
958e1b
                               s->cirrus_blt_dstaddr & s->cirrus_addr_mask)) {
958e1b
         return true;
958e1b
-- 
958e1b
1.8.3.1
958e1b