From: Kevin Wolf <kwolf@redhat.com>
To: Max Reitz <mreitz@redhat.com>
Cc: qemu-stable@nongnu.org, Fam Zheng <famz@redhat.com>,
qemu-devel@nongnu.org, qemu-block@nongnu.org, rjones@redhat.com
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH] vmdk: Fix overflow if l1_size is 0x20000000
Date: Fri, 8 May 2015 12:52:00 +0200 [thread overview]
Message-ID: <20150508105200.GG4318@noname.redhat.com> (raw)
In-Reply-To: <554A5462.7010103@redhat.com>
Am 06.05.2015 um 19:50 hat Max Reitz geschrieben:
> On 05.05.2015 11:28, Fam Zheng wrote:
> >Richard Jones caught this bug with afl fuzzer.
> >
> >In fact, that's the only possible value to overflow (extent->l1_size =
> >0x20000000) l1_size:
> >
> >l1_size = extent->l1_size * sizeof(long) => 0x80000000;
> >
> >g_try_malloc returns NULL because l1_size is interpreted as negative
> >during type casting from 'int' to 'gsize', which yields a enormous
> >value. Hence, by coincidence, we get a "not too bad" behavior:
> >
> >qemu-img: Could not open '/tmp/afl6.img': Could not open
> >'/tmp/afl6.img': Cannot allocate memory
> >
> >Values larger than 0x20000000 will be refused by the validation in
> >vmdk_add_extent.
> >
> >Values smaller than 0x20000000 will not overflow l1_size.
> >
> >Reported-by: Richard W.M. Jones <rjones@redhat.com>
> >Signed-off-by: Fam Zheng <famz@redhat.com>
> >---
> > block/vmdk.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
>
> Okay, so because size_t is unsigned, this will not overflow on
> systems with sizeof(size_t) == 4 either.
>
> Reviewed-by: Max Reitz <mreitz@redhat.com>
Thanks, applied to the block branch. I think this one is for stable,
too.
Kevin
prev parent reply other threads:[~2015-05-08 10:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-05 9:28 [Qemu-devel] [PATCH] vmdk: Fix overflow if l1_size is 0x20000000 Fam Zheng
2015-05-05 9:58 ` Richard W.M. Jones
2015-05-06 17:50 ` [Qemu-devel] [Qemu-block] " Max Reitz
2015-05-08 10:52 ` Kevin Wolf [this message]
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=20150508105200.GG4318@noname.redhat.com \
--to=kwolf@redhat.com \
--cc=famz@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=rjones@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.