From: Kevin Wolf <kwolf@redhat.com>
To: gerben@altlinux.org
Cc: qemu-devel@nongnu.org, hreitz@redhat.com, sdl.qemu@linuxtesting.org
Subject: Re: [PATCH] qemu-img: fix division by zero in bench_cb() for zero-sized images
Date: Tue, 18 Mar 2025 13:03:12 +0100 [thread overview]
Message-ID: <Z9lg88JF7FUYcxw1@redhat.com> (raw)
In-Reply-To: <20250318101933.255617-1-gerben@altlinux.org>
Am 18.03.2025 um 11:19 hat gerben@altlinux.org geschrieben:
> From: Denis Rastyogin <gerben@altlinux.org>
>
> This error was discovered by fuzzing qemu-img.
>
> This commit fixes a division by zero error in the bench_cb() function
> that occurs when using the bench command with a zero-sized image.
>
> The issue arises because b->image_size can be zero, leading to a
> division by zero in the modulo operation (b->offset %= b->image_size).
> This patch adds a check for b->image_size == 0 and resets b->offset
> to 0 in such cases, preventing the error.
>
> Signed-off-by: Denis Rastyogin <gerben@altlinux.org>
Thanks, applied to the block branch.
Kevin
prev parent reply other threads:[~2025-03-18 12:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-18 10:19 [PATCH] qemu-img: fix division by zero in bench_cb() for zero-sized images gerben
2025-03-18 12:03 ` 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=Z9lg88JF7FUYcxw1@redhat.com \
--to=kwolf@redhat.com \
--cc=gerben@altlinux.org \
--cc=hreitz@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sdl.qemu@linuxtesting.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).