Skip to content
Snippets Groups Projects
Commit 82a628f8 authored by Sebastian Mitterle's avatar Sebastian Mitterle Committed by Gerd Hoffmann
Browse files

qemu-edid: Restrict input parameter -d to avoid division by zero


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: default avatarThomas Huth <thuth@redhat.com>
Signed-off-by: default avatarSebastian Mitterle <smitterl@redhat.com>
Message-Id: <20221011151216.64897-1-smitterl@redhat.com>
Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent 8af5f82b
No related branches found
No related tags found
No related merge requests found
...@@ -92,6 +92,10 @@ int main(int argc, char *argv[]) ...@@ -92,6 +92,10 @@ int main(int argc, char *argv[])
fprintf(stderr, "not a number: %s\n", optarg); fprintf(stderr, "not a number: %s\n", optarg);
exit(1); exit(1);
} }
if (dpi == 0) {
fprintf(stderr, "cannot be zero: %s\n", optarg);
exit(1);
}
break; break;
case 'v': case 'v':
info.vendor = optarg; info.vendor = optarg;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment