|
|
3a13dd |
From: Prasad J Pandit <pjp@fedoraproject.org>
|
|
|
3a13dd |
Date: Thu, 8 Sep 2016 18:15:54 +0530
|
|
|
3a13dd |
Subject: [PATCH] vmsvga: correct bitmap and pixmap size checks
|
|
|
3a13dd |
|
|
|
3a13dd |
When processing svga command DEFINE_CURSOR in vmsvga_fifo_run,
|
|
|
3a13dd |
the computed BITMAP and PIXMAP size are checked against the
|
|
|
3a13dd |
'cursor.mask[]' and 'cursor.image[]' array sizes in bytes.
|
|
|
3a13dd |
Correct these checks to avoid OOB memory access.
|
|
|
3a13dd |
|
|
|
3a13dd |
Reported-by: Qinghao Tang <luodalongde@gmail.com>
|
|
|
3a13dd |
Reported-by: Li Qiang <liqiang6-s@360.cn>
|
|
|
3a13dd |
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
|
|
|
3a13dd |
Message-id: 1473338754-15430-1-git-send-email-ppandit@redhat.com
|
|
|
3a13dd |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
3a13dd |
(cherry picked from commit 167d97a3def77ee2dbf6e908b0ecbfe2103977db)
|
|
|
3a13dd |
---
|
|
|
3a13dd |
hw/display/vmware_vga.c | 12 +++++++-----
|
|
|
3a13dd |
1 file changed, 7 insertions(+), 5 deletions(-)
|
|
|
3a13dd |
|
|
|
3a13dd |
diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
|
|
|
3a13dd |
index e51a05e..6599cf0 100644
|
|
|
3a13dd |
--- a/hw/display/vmware_vga.c
|
|
|
3a13dd |
+++ b/hw/display/vmware_vga.c
|
|
|
3a13dd |
@@ -676,11 +676,13 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s)
|
|
|
3a13dd |
cursor.bpp = vmsvga_fifo_read(s);
|
|
|
3a13dd |
|
|
|
3a13dd |
args = SVGA_BITMAP_SIZE(x, y) + SVGA_PIXMAP_SIZE(x, y, cursor.bpp);
|
|
|
3a13dd |
- if (cursor.width > 256 ||
|
|
|
3a13dd |
- cursor.height > 256 ||
|
|
|
3a13dd |
- cursor.bpp > 32 ||
|
|
|
3a13dd |
- SVGA_BITMAP_SIZE(x, y) > sizeof cursor.mask ||
|
|
|
3a13dd |
- SVGA_PIXMAP_SIZE(x, y, cursor.bpp) > sizeof cursor.image) {
|
|
|
3a13dd |
+ if (cursor.width > 256
|
|
|
3a13dd |
+ || cursor.height > 256
|
|
|
3a13dd |
+ || cursor.bpp > 32
|
|
|
3a13dd |
+ || SVGA_BITMAP_SIZE(x, y)
|
|
|
3a13dd |
+ > sizeof(cursor.mask) / sizeof(cursor.mask[0])
|
|
|
3a13dd |
+ || SVGA_PIXMAP_SIZE(x, y, cursor.bpp)
|
|
|
3a13dd |
+ > sizeof(cursor.image) / sizeof(cursor.image[0])) {
|
|
|
3a13dd |
goto badcmd;
|
|
|
3a13dd |
}
|
|
|
3a13dd |
|