Skip to content

Commit 82a628f

Browse files
smitterlkraxel
authored andcommitted
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: Thomas Huth <[email protected]> Signed-off-by: Sebastian Mitterle <[email protected]> Message-Id: <[email protected]> Signed-off-by: Gerd Hoffmann <[email protected]>
1 parent 8af5f82 commit 82a628f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

qemu-edid.c

+4
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ int main(int argc, char *argv[])
9292
fprintf(stderr, "not a number: %s\n", optarg);
9393
exit(1);
9494
}
95+
if (dpi == 0) {
96+
fprintf(stderr, "cannot be zero: %s\n", optarg);
97+
exit(1);
98+
}
9599
break;
96100
case 'v':
97101
info.vendor = optarg;

0 commit comments

Comments
 (0)