Received: from eggs.gnu.org ([2001:4830:134:3::10]:37504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xem3S-00072O-KW for qemu-devel@nongnu.org; Thu, 16 Oct 2014 10:29:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xem3M-0006jS-Vw for qemu-devel@nongnu.org; Thu, 16 Oct 2014 10:29:26 -0400 Date: Thu, 16 Oct 2014 10:29:18 -0400 From: Don Koch Message-Id: <20141016102918.936500eb3e11fb927a0253da@verizon.com> In-Reply-To: <1413367839-30999-6-git-send-email-kraxel@redhat.com> References: <1413367839-30999-1-git-send-email-kraxel@redhat.com> <1413367839-30999-6-git-send-email-kraxel@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 4/5] vmware-vga: use vmsvga_verify_rect in vmsvga_copy_rect List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: Intel.Product.Security.Incident.Response.Team@intel.com, pmatouse@redhat.com, qemu-devel@nongnu.org, qemu-stable@nongnu.org On Wed, 15 Oct 2014 12:10:38 +0200 Gerd Hoffmann wrote: > Add verification to vmsvga_copy_rect, re-enable HW_RECT_ACCEL. > > Cc: qemu-stable@nongnu.org > Signed-off-by: Gerd Hoffmann > --- > hw/display/vmware_vga.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c > index 9d79de6..1fc9641 100644 > --- a/hw/display/vmware_vga.c > +++ b/hw/display/vmware_vga.c > @@ -29,8 +29,8 @@ > #include "hw/pci/pci.h" > > #undef VERBOSE > -#if 0 > #define HW_RECT_ACCEL > +#if 0 > #define HW_FILL_ACCEL > #endif > #define HW_MOUSE_ACCEL > @@ -417,6 +417,13 @@ static inline void vmsvga_copy_rect(struct vmsvga_state_s *s, > int line = h; > uint8_t *ptr[2]; > > + if (!vmsvga_verify_rect(surface, "vmsvga_copy_rect/src", x0, y0, w, h)) { > + return; > + } > + if (!vmsvga_verify_rect(surface, "vmsvga_copy_rect/dst", x1, y1, w, h)) { > + return; > + } > + If I read this correctly, if either the source or destination are even partially off-screen, the copy silently fails, which sounds wrong. I'd suggest having this function return false if one of these checks fail so the caller can do something appropriate (like "goto badcmd"). -d > if (y1 > y0) { > ptr[0] = vram + bypp * x0 + bypl * (y0 + h - 1); > ptr[1] = vram + bypp * x1 + bypl * (y1 + h - 1); > -- > 1.8.3.1 > >