]> rtime.felk.cvut.cz Git - lisovros/qemu_apohw.git/commitdiff
cirrus: Fix host CPU blits
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Mon, 7 Jul 2014 00:32:34 +0000 (10:32 +1000)
committerGerd Hoffmann <kraxel@redhat.com>
Fri, 11 Jul 2014 08:17:02 +0000 (10:17 +0200)
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

index 9c7bb092862cc5f9a49b9a3d22f82a0336af1387..0925a009fefd958d4c893a5f4c99e0d63075dd45 100644 (file)
@@ -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;
     }