From 2b689db0bedd24eda8b491cb1fcfb015dfec5a31 Mon Sep 17 00:00:00 2001 From: Denis Rastyogin Date: Thu, 27 Mar 2025 19:24:23 +0300 Subject: [PATCH] qemu-img: improve queue depth validation in img_bench This error was discovered by fuzzing qemu-img. Currently, running `qemu-img bench -d 0` in img_bench is allowed, which is a pointless operation and causes qemu-img to hang. Signed-off-by: Denis Rastyogin Message-ID: <20250327162423.25154-5-gerben@altlinux.org> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- qemu-img.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu-img.c b/qemu-img.c index 2044c22a4c7..76ac5d3028b 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -4571,7 +4571,7 @@ static int img_bench(int argc, char **argv) { unsigned long res; - if (qemu_strtoul(optarg, NULL, 0, &res) < 0 || res > INT_MAX) { + if (qemu_strtoul(optarg, NULL, 0, &res) <= 0 || res > INT_MAX) { error_report("Invalid queue depth specified"); return 1; } -- 2.47.2