qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL 3/3] cirrus: Fix host CPU blits
Date: Fri, 11 Jul 2014 12:24:38 +0200	[thread overview]
Message-ID: <1405074278-16230-4-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1405074278-16230-1-git-send-email-kraxel@redhat.com>

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Commit b2eb849d4b1fdb6f35d5c46958c7f703cf64cfef
"CVE-2007-1320 - Cirrus LGD-54XX "bitblt" heap overflow" broke
cpu to video blits.

When the ROP function is called from cirrus_bitblt_cputovideo_next(),
we pass 0 for the pitch but only operate on one line at a time. The
added test was tripping because after the initial substraction, the
pitch becomes negative. Make the test only trip when the height is
larger than one (ie. the pitch is actually used).

This fixes HW cursor support in Windows NT4.0 (which otherwise was
a white rectangle) and general display of icons in that OS when using
8bpp mode.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/display/cirrus_vga_rop.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/display/cirrus_vga_rop.h b/hw/display/cirrus_vga_rop.h
index 9c7bb09..0925a00 100644
--- a/hw/display/cirrus_vga_rop.h
+++ b/hw/display/cirrus_vga_rop.h
@@ -52,8 +52,7 @@ glue(cirrus_bitblt_rop_fwd_, ROP_NAME)(CirrusVGAState *s,
     dstpitch -= bltwidth;
     srcpitch -= bltwidth;
 
-    if (dstpitch < 0 || srcpitch < 0) {
-        /* is 0 valid? srcpitch == 0 could be useful */
+    if (bltheight > 1 && (dstpitch < 0 || srcpitch < 0)) {
         return;
     }
 
-- 
1.8.3.1

  parent reply	other threads:[~2014-07-11 10:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-11 10:24 [Qemu-devel] [PULL 0/3] vga: some cirrus fixes Gerd Hoffmann
2014-07-11 10:24 ` [Qemu-devel] [PULL 1/3] cirrus_vga: adding sanity check for vram size Gerd Hoffmann
2014-07-11 10:24 ` [Qemu-devel] [PULL 2/3] cirrus: Fix build of debug code Gerd Hoffmann
2014-07-11 10:24 ` Gerd Hoffmann [this message]
2014-07-14  7:24   ` [Qemu-devel] [PULL 3/3] cirrus: Fix host CPU blits Peter Lieven
2014-07-14  7:29     ` Benjamin Herrenschmidt
2014-07-14  7:33       ` Benjamin Herrenschmidt
2014-07-14  8:28       ` Peter Lieven
2014-07-14  9:53         ` Gerd Hoffmann
2014-07-14 12:56           ` Peter Lieven
2014-07-14 16:03             ` Gerd Hoffmann
2014-07-11 17:47 ` [Qemu-devel] [PULL 0/3] vga: some cirrus fixes Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1405074278-16230-4-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).