aboutsummaryrefslogtreecommitdiff
path: root/rust/qemu-api/src
diff options
context:
space:
mode:
authorDenis Rastyogin <gerben@altlinux.org>2025-03-18 13:19:00 +0300
committerKevin Wolf <kwolf@redhat.com>2025-04-08 12:13:17 +0200
commit6b36a578316e3b14a53ae7699571d01b00fc2f8a (patch)
tree7d130841894c9e548cc2713d850f5d1f0e4f0559 /rust/qemu-api/src
parentdfaecc04c46d298e9ee81bd0ca96d8754f1c27ed (diff)
downloadqemu-6b36a578316e3b14a53ae7699571d01b00fc2f8a.zip
qemu-6b36a578316e3b14a53ae7699571d01b00fc2f8a.tar.gz
qemu-6b36a578316e3b14a53ae7699571d01b00fc2f8a.tar.bz2
qemu-img: fix division by zero in bench_cb() for zero-sized images
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> Message-ID: <20250318101933.255617-1-gerben@altlinux.org> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'rust/qemu-api/src')
0 files changed, 0 insertions, 0 deletions