qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: P J P <ppandit@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: Qemu Developers <qemu-devel@nongnu.org>,
	Qinghao Tang <luodalongde@gmail.com>,
	Li Qiang <liqiang6-s@360.cn>
Subject: Re: [Qemu-devel] [PATCH] vmsvga: correct bitmap and pixmap size checks
Date: Tue, 13 Sep 2016 12:32:49 +0530 (IST)	[thread overview]
Message-ID: <alpine.LFD.2.20.1609131232200.27819@wniryva> (raw)
In-Reply-To: <1473338754-15430-1-git-send-email-ppandit@redhat.com>

+-- On Thu, 8 Sep 2016, P J P wrote --+
| From: Prasad J Pandit <pjp@fedoraproject.org>
| 
| 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 <luodalongde@gmail.com>
| Reported-by: Li Qiang <liqiang6-s@360.cn>
| Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
| ---
|  hw/display/vmware_vga.c | 12 +++++++-----
|  1 file changed, 7 insertions(+), 5 deletions(-)
| 
| diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
| index e51a05e..6599cf0 100644
| --- a/hw/display/vmware_vga.c
| +++ b/hw/display/vmware_vga.c
| @@ -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;
|              }

Ping...!
--
Prasad J Pandit / Red Hat Product Security Team
47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F

  reply	other threads:[~2016-09-13  7:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-08 12:45 [Qemu-devel] [PATCH] vmsvga: correct bitmap and pixmap size checks P J P
2016-09-13  7:02 ` P J P [this message]
2016-09-13  7:26 ` Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.20.1609131232200.27819@wniryva \
    --to=ppandit@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=liqiang6-s@360.cn \
    --cc=luodalongde@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).