From: Sebastian Mitterle <smitterl@redhat.com>
To: qemu-devel@nongnu.org
Cc: kraxel@redhat.com, thuth@redhat.com, qemu-trivial@nongnu.org
Subject: [PATCH] qemu-edid: Restrict input parameter -d to avoid division by zero
Date: Tue, 11 Oct 2022 17:12:16 +0200 [thread overview]
Message-ID: <20221011151216.64897-1-smitterl@redhat.com> (raw)
A zero value for dpi will lead to a division by zero in qemu_edid_dpi_to_mm().
Tested by runnig qemu-edid -dX, X = 0, 100.
Resolves: qemu-project/qemu#1249
Suggested-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Sebastian Mitterle <smitterl@redhat.com>
---
qemu-edid.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/qemu-edid.c b/qemu-edid.c
index 20c958d9c7..92e1a660a7 100644
--- a/qemu-edid.c
+++ b/qemu-edid.c
@@ -92,6 +92,10 @@ int main(int argc, char *argv[])
fprintf(stderr, "not a number: %s\n", optarg);
exit(1);
}
+ if (dpi == 0) {
+ fprintf(stderr, "cannot be zero: %s\n", optarg);
+ exit(1);
+ }
break;
case 'v':
info.vendor = optarg;
--
2.37.3
next reply other threads:[~2022-10-11 15:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-11 15:12 Sebastian Mitterle [this message]
2022-10-12 12:33 ` [PATCH] qemu-edid: Restrict input parameter -d to avoid division by zero Gerd Hoffmann
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=20221011151216.64897-1-smitterl@redhat.com \
--to=smitterl@redhat.com \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=thuth@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 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).