From eac3ec53eeaaacb75ae673981c85aafaae5e25ad Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Alon Levy Date: Sun, 7 Oct 2012 15:31:57 +0200 Subject: [PATCH 20/27] qxl/update_area_io: guest_bug on invalid parameters RH-Author: Alon Levy Message-id: <1349623920-19894-14-git-send-email-alevy@redhat.com> Patchwork-id: 42788 O-Subject: [PATCH RHEL-6.4 v2 13/16] qxl/update_area_io: guest_bug on invalid parameters Bugzilla: 770842 RH-Acked-by: Gerd Hoffmann RH-Acked-by: Paolo Bonzini RH-Acked-by: Arnon Gilboa Signed-off-by: Alon Levy Signed-off-by: Gerd Hoffmann Upstream: 511b13e2c9b426b3c56060909693de5097f0b496 --- hw/qxl.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) Signed-off-by: Michal Novotny --- hw/qxl.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/qxl.c b/hw/qxl.c index 3862f15..73c7ad2 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -1406,6 +1406,18 @@ async_common: QXLCookie *cookie = NULL; QXLRect update = d->ram->update_area; + if (d->ram->update_surface > NUM_SURFACES) { + qxl_set_guest_bug(d, "QXL_IO_UPDATE_AREA: invalid surface id %d\n", + d->ram->update_surface); + return; + } + if (update.left >= update.right || update.top >= update.bottom) { + qxl_set_guest_bug(d, + "QXL_IO_UPDATE_AREA: invalid area (%ux%u)x(%ux%u)\n", + update.left, update.top, update.right, update.bottom); + return; + } + if (async == QXL_ASYNC) { cookie = qxl_cookie_new(QXL_COOKIE_TYPE_IO, QXL_IO_UPDATE_AREA_ASYNC); -- 1.7.11.7