Skip to content

Commit

Permalink
qemu-edid: Restrict input parameter -d to avoid division by zero
Browse files Browse the repository at this point in the history
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>
Message-Id: <20221011151216.64897-1-smitterl@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
  • Loading branch information
smitterl authored and kraxel committed Oct 12, 2022
1 parent 8af5f82 commit 82a628f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions qemu-edid.c
Expand Up @@ -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;
Expand Down

0 comments on commit 82a628f

Please sign in to comment.