dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0107-qxl-update_area_io-guest_bug-on-invalid-parameters.patch

5544c1
From 8a3d428e1e0f3e4793b1a1353c638e155a3a8a86 Mon Sep 17 00:00:00 2001
Hans de Goede c8dfc6
From: Alon Levy <alevy@redhat.com>
Hans de Goede c8dfc6
Date: Tue, 21 Aug 2012 13:51:31 +0300
5544c1
Subject: [PATCH] qxl/update_area_io: guest_bug on invalid parameters
Hans de Goede c8dfc6
Hans de Goede c8dfc6
Signed-off-by: Alon Levy <alevy@redhat.com>
Hans de Goede c8dfc6
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5544c1
(cherry picked from commit 511b13e2c9b426b3c56060909693de5097f0b496)
5544c1
5544c1
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Hans de Goede c8dfc6
---
Hans de Goede c8dfc6
 hw/qxl.c | 12 ++++++++++++
Hans de Goede c8dfc6
 1 file changed, 12 insertions(+)
Hans de Goede c8dfc6
Hans de Goede c8dfc6
diff --git a/hw/qxl.c b/hw/qxl.c
Hans de Goede c8dfc6
index 95bbc03..baf9bb4 100644
Hans de Goede c8dfc6
--- a/hw/qxl.c
Hans de Goede c8dfc6
+++ b/hw/qxl.c
Hans de Goede c8dfc6
@@ -1386,6 +1386,18 @@ async_common:
Hans de Goede c8dfc6
         QXLCookie *cookie = NULL;
Hans de Goede c8dfc6
         QXLRect update = d->ram->update_area;
Hans de Goede c8dfc6
 
Hans de Goede c8dfc6
+        if (d->ram->update_surface > NUM_SURFACES) {
Hans de Goede c8dfc6
+            qxl_set_guest_bug(d, "QXL_IO_UPDATE_AREA: invalid surface id %d\n",
Hans de Goede c8dfc6
+                              d->ram->update_surface);
Hans de Goede c8dfc6
+            return;
Hans de Goede c8dfc6
+        }
Hans de Goede c8dfc6
+        if (update.left >= update.right || update.top >= update.bottom) {
Hans de Goede c8dfc6
+            qxl_set_guest_bug(d,
Hans de Goede c8dfc6
+                    "QXL_IO_UPDATE_AREA: invalid area (%ux%u)x(%ux%u)\n",
Hans de Goede c8dfc6
+                    update.left, update.top, update.right, update.bottom);
Hans de Goede c8dfc6
+            return;
Hans de Goede c8dfc6
+        }
Hans de Goede c8dfc6
+
Hans de Goede c8dfc6
         if (async == QXL_ASYNC) {
Hans de Goede c8dfc6
             cookie = qxl_cookie_new(QXL_COOKIE_TYPE_IO,
Hans de Goede c8dfc6
                                     QXL_IO_UPDATE_AREA_ASYNC);
Hans de Goede c8dfc6
-- 
5544c1
1.7.12.1
Hans de Goede c8dfc6