Skip to content

Commit f018edc

Browse files
zbalatonkraxel
authored andcommitted
sm501: Do not allow guest to set invalid format
Prevent guest setting invalid format value that might trip checks in sm501_2d_operation(). Signed-off-by: BALATON Zoltan <[email protected]> Reviewed-by: Peter Maydell <[email protected]> Message-id: 26d4fa9b8ce81e2723e98d592ccba7550042752c.1592686588.git.balaton@eik.bme.hu Signed-off-by: Gerd Hoffmann <[email protected]>
1 parent ba27110 commit f018edc

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

hw/display/sm501.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,6 +1503,9 @@ static void sm501_2d_engine_write(void *opaque, hwaddr addr,
15031503
s->twoD_background = value;
15041504
break;
15051505
case SM501_2D_STRETCH:
1506+
if (((value >> 20) & 3) == 3) {
1507+
value &= ~BIT(20);
1508+
}
15061509
s->twoD_stretch = value;
15071510
break;
15081511
case SM501_2D_COLOR_COMPARE:

0 commit comments

Comments
 (0)