v2: Correct detection of overflow. [Markus, Berto] If the image has a huge enough virtual size,
$ qemu-img info afl9.img qemu-img: Can't get size of device 'image': Unknown error -512 It's because of the multiplication overflow in the return statement in bdrv_getlength (the big nagetive value is later truncated to 0x200). Fix it to return -EFBIG: qemu-img: Can't get size of device 'image': File too large Bug reported by Richard Jones in: https://bugzilla.redhat.com/show_bug.cgi?id=1221499 Fam Zheng (2): block: Detect multiplication overflow in bdrv_getlength qemu-iotests: qemu-img info on afl VMDK image with a huge capacity block.c | 1 + tests/qemu-iotests/059 | 5 +++++ tests/qemu-iotests/059.out | 3 +++ tests/qemu-iotests/sample_images/afl9.vmdk.bz2 | Bin 0 -> 178 bytes 4 files changed, 9 insertions(+) create mode 100644 tests/qemu-iotests/sample_images/afl9.vmdk.bz2 -- 2.4.0