* [PATCH] qemu-edid: Restrict input parameter -d to avoid division by zero
@ 2022-10-11 15:12 Sebastian Mitterle
2022-10-12 12:33 ` Gerd Hoffmann
0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Mitterle @ 2022-10-11 15:12 UTC (permalink / raw)
To: qemu-devel; +Cc: kraxel, thuth, qemu-trivial
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] qemu-edid: Restrict input parameter -d to avoid division by zero
2022-10-11 15:12 [PATCH] qemu-edid: Restrict input parameter -d to avoid division by zero Sebastian Mitterle
@ 2022-10-12 12:33 ` Gerd Hoffmann
0 siblings, 0 replies; 2+ messages in thread
From: Gerd Hoffmann @ 2022-10-12 12:33 UTC (permalink / raw)
To: Sebastian Mitterle; +Cc: qemu-devel, thuth, qemu-trivial
On Tue, Oct 11, 2022 at 05:12:16PM +0200, Sebastian Mitterle wrote:
> 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>
Added to queue.
thanks,
Gerd
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-10-12 12:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-11 15:12 [PATCH] qemu-edid: Restrict input parameter -d to avoid division by zero Sebastian Mitterle
2022-10-12 12:33 ` Gerd Hoffmann
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).