qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Matteo Cascella <mcascell@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: "Marc-André Lureau" <marcandre.lureau@gmail.com>,
	QEMU <qemu-devel@nongnu.org>
Subject: Re: [PATCH] ui/cursor: fix integer overflow in cursor_alloc (CVE-2022-4206)
Date: Tue, 5 Apr 2022 16:47:18 +0200	[thread overview]
Message-ID: <CAA8xKjVX0BsosHQNOrfOemOhgv03qqVK0NFVAoCZa-3v4XWSxg@mail.gmail.com> (raw)
In-Reply-To: <20220405111010.kpjlfvtow7jxzk7w@sirius.home.kraxel.org>

On Tue, Apr 5, 2022 at 1:10 PM Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> > > +++ b/ui/cursor.c
> > > @@ -46,6 +46,13 @@ static QEMUCursor *cursor_parse_xpm(const char *xpm[])
> > >
> > >      /* parse pixel data */
> > >      c = cursor_alloc(width, height);
> > > +
> > > +    if (!c) {
> > > +        fprintf(stderr, "%s: cursor %ux%u alloc error\n",
> > > +                __func__, width, height);
> > > +        return NULL;
> > > +    }
> > >
> >
> > I think you could simply abort() in this function. It is used with static
> > data (ui/cursor*.xpm)
>
> Yes, that should never happen.
>
> Missing: vmsvga_cursor_define() calls cursor_alloc() with guest-supplied
> values too.

I skipped that because the check (cursor.width > 256 || cursor.height
> 256) is already done in vmsvga_fifo_run before calling
vmsvga_cursor_define. You want me to add another check in
vmsvga_cursor_define and return NULL if cursor_alloc fails?

> take care,
>   Gerd
>


--
Mauro Matteo Cascella
Red Hat Product Security
PGP-Key ID: BB3410B0



  reply	other threads:[~2022-04-05 14:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-05 10:32 [PATCH] ui/cursor: fix integer overflow in cursor_alloc (CVE-2022-4206) Mauro Matteo Cascella
2022-04-05 10:55 ` Marc-André Lureau
2022-04-05 11:10   ` Gerd Hoffmann
2022-04-05 14:47     ` Mauro Matteo Cascella [this message]
2022-04-06  6:24       ` Gerd Hoffmann
2022-04-05 11:56 ` Peter Maydell

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=CAA8xKjVX0BsosHQNOrfOemOhgv03qqVK0NFVAoCZa-3v4XWSxg@mail.gmail.com \
    --to=mcascell@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=marcandre.lureau@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).