]> Git Repo - qemu.git/commitdiff
vmsvga: correct bitmap and pixmap size checks
authorPrasad J Pandit <[email protected]>
Thu, 8 Sep 2016 12:45:54 +0000 (18:15 +0530)
committerGerd Hoffmann <[email protected]>
Tue, 13 Sep 2016 07:24:35 +0000 (09:24 +0200)
When processing svga command DEFINE_CURSOR in vmsvga_fifo_run,
the computed BITMAP and PIXMAP size are checked against the
'cursor.mask[]' and 'cursor.image[]' array sizes in bytes.
Correct these checks to avoid OOB memory access.

Reported-by: Qinghao Tang <[email protected]>
Reported-by: Li Qiang <[email protected]>
Signed-off-by: Prasad J Pandit <[email protected]>
Message-id: 1473338754[email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
hw/display/vmware_vga.c

index e51a05ea7e48505af029ae9e5e9b0a243812d1d0..6599cf078d22f794e9eb54450f602ce022136fe8 100644 (file)
@@ -676,11 +676,13 @@ static void vmsvga_fifo_run(struct vmsvga_state_s *s)
             cursor.bpp = vmsvga_fifo_read(s);
 
             args = SVGA_BITMAP_SIZE(x, y) + SVGA_PIXMAP_SIZE(x, y, cursor.bpp);
-            if (cursor.width > 256 ||
-                cursor.height > 256 ||
-                cursor.bpp > 32 ||
-                SVGA_BITMAP_SIZE(x, y) > sizeof cursor.mask ||
-                SVGA_PIXMAP_SIZE(x, y, cursor.bpp) > sizeof cursor.image) {
+            if (cursor.width > 256
+                || cursor.height > 256
+                || cursor.bpp > 32
+                || SVGA_BITMAP_SIZE(x, y)
+                    > sizeof(cursor.mask) / sizeof(cursor.mask[0])
+                || SVGA_PIXMAP_SIZE(x, y, cursor.bpp)
+                    > sizeof(cursor.image) / sizeof(cursor.image[0])) {
                     goto badcmd;
             }
 
This page took 0.030459 seconds and 4 git commands to generate.