]> git.proxmox.com Git - mirror_qemu.git/commitdiff
sm501: Do not allow guest to set invalid format
authorBALATON Zoltan <balaton@eik.bme.hu>
Sat, 20 Jun 2020 20:56:28 +0000 (22:56 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 30 Jun 2020 20:46:28 +0000 (22:46 +0200)
Prevent guest setting invalid format value that might trip checks in
sm501_2d_operation().

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 26d4fa9b8ce81e2723e98d592ccba7550042752c.1592686588.git.balaton@eik.bme.hu
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/display/sm501.c

index 6349f31e6491307ba36c6b0ef24b0ce4b3d20fd9..7e4c042d52295d49f24ce7aef3d110ced11eb31c 100644 (file)
@@ -1503,6 +1503,9 @@ static void sm501_2d_engine_write(void *opaque, hwaddr addr,
         s->twoD_background = value;
         break;
     case SM501_2D_STRETCH:
+        if (((value >> 20) & 3) == 3) {
+            value &= ~BIT(20);
+        }
         s->twoD_stretch = value;
         break;
     case SM501_2D_COLOR_COMPARE: