thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
0a122b
From c5e26182fedef98b73f50e9fac3ae09696e59880 Mon Sep 17 00:00:00 2001
0a122b
From: Gerd Hoffmann <kraxel@redhat.com>
0a122b
Date: Wed, 26 Feb 2014 11:44:47 +0100
0a122b
Subject: [PATCH 2/6] qxl: add sanity check
0a122b
0a122b
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
0a122b
Message-id: <1393415087-3776-2-git-send-email-kraxel@redhat.com>
0a122b
Patchwork-id: 57815
0a122b
O-Subject: [RHEL-7 qemu-kvm PATCH 1/1] qxl: add sanity check
0a122b
Bugzilla: 751937
0a122b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
0a122b
RH-Acked-by: Dr. David Alan Gilbert (git) <dgilbert@redhat.com>
0a122b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
0a122b
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
0a122b
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
0a122b
(cherry picked from commit 9c70434f825fd0d2e89d1aa0f872159378d0aab3)
0a122b
---
0a122b
 hw/display/qxl.c | 8 +++++++-
0a122b
 1 file changed, 7 insertions(+), 1 deletion(-)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 hw/display/qxl.c |    8 +++++++-
0a122b
 1 files changed, 7 insertions(+), 1 deletions(-)
0a122b
0a122b
diff --git a/hw/display/qxl.c b/hw/display/qxl.c
0a122b
index 4381d97..4fe4f1b 100644
0a122b
--- a/hw/display/qxl.c
0a122b
+++ b/hw/display/qxl.c
0a122b
@@ -1417,7 +1417,7 @@ static int qxl_destroy_primary(PCIQXLDevice *d, qxl_async_io async)
0a122b
     return 1;
0a122b
 }
0a122b
 
0a122b
-static void qxl_set_mode(PCIQXLDevice *d, int modenr, int loadvm)
0a122b
+static void qxl_set_mode(PCIQXLDevice *d, unsigned int modenr, int loadvm)
0a122b
 {
0a122b
     pcibus_t start = d->pci.io_regions[QXL_RAM_RANGE_INDEX].addr;
0a122b
     pcibus_t end   = d->pci.io_regions[QXL_RAM_RANGE_INDEX].size + start;
0a122b
@@ -1427,6 +1427,12 @@ static void qxl_set_mode(PCIQXLDevice *d, int modenr, int loadvm)
0a122b
         .mem_start = start,
0a122b
         .mem_end = end
0a122b
     };
0a122b
+
0a122b
+    if (modenr >= d->modes->n_modes) {
0a122b
+        qxl_set_guest_bug(d, "mode number out of range");
0a122b
+        return;
0a122b
+    }
0a122b
+
0a122b
     QXLSurfaceCreate surface = {
0a122b
         .width      = mode->x_res,
0a122b
         .height     = mode->y_res,
0a122b
-- 
0a122b
1.7.1
0a122b