vmdk: Fix integer overflow in offset calculation
PATCH v5 1/1 vmdk: Fix integer overflow in offset calculation
This fixes the bug introduced by commit c6ac36e (vmdk: Optimize cluster allocation).
$ ~/build/master/qemu-io /stor/vm/arch.vmdk -c 'write 2G 1k' write failed: Invalid argument
Reported-by Mark Cave-Ayland <[email protected]>
Reviewed-by Max Reitz <[email protected]>
Signed-off-by Fam Zheng <[email protected]>
---
v5: Fix group file and output reference. (Max)
v4: Fix typo in file header: 1014 -> 2014.
v3: A new case 105 instead of embedding in 005. (Max)
--- block/vmdk.c | 2 +- tests/qemu-iotests/105 | 70 ++++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/105.out | 21 ++++++++++++++ tests/qemu-iotests/group | 1 + 4 files changed, 93 insertions(+), 1 deletion(-) create mode 100755 tests/qemu-iotests/105 create mode 100644 tests/qemu-iotests/105.out
block/vmdk.c +1 -1
@@ -1113,7 +1113,7 @@ static int get_cluster_offset(BlockDriverState *bs,uint32_t min_count, *l2_table;bool zeroed = false;int64_t ret; -int32_t cluster_sector; +int64_t cluster_sector;if (m_data) { m_data->valid =0 ;
tests/qemu-iotests/105 new file +70 -0
70 lines not on this page · raw message
tests/qemu-iotests/105.out new file +21 -0
@@ -0,0 +1,21 @@ +QA output created by 105 + +creating large image +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=17592186044416 + +small read +read 4096/4096 bytes at offset 1024 +4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +small write +wrote 4096/4096 bytes at offset 8192 +4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +small read at high offset +read 4096/4096 bytes at offset 15393162788864 +4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +small write at high offset +wrote 4096/4096 bytes at offset 15393162788864 +4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +*** done
tests/qemu-iotests/group +1 -0
@@ -105,3 +105,4 @@ 101 rw auto quick 103 rw auto quick 104 rw auto +105 rw auto quick
Signature · 1 line
1.9.3
Stefan Hajnoczi
AppliedQuoted 14 lines · Fam Zheng
This fixes the bug introduced by commit c6ac36e (vmdk: Optimize cluster allocation).
$ ~/build/master/qemu-io /stor/vm/arch.vmdk -c 'write 2G 1k' write failed: Invalid argumentReported-by Mark Cave-Ayland <[email protected]>Reviewed-by Max Reitz <[email protected]>Signed-off-by Fam Zheng <[email protected]>---
v5: Fix group file and output reference. (Max)
v4: Fix typo in file header: 1014 -> 2014.
v3: A new case 105 instead of embedding in 005. (Max)
Quoted 8 lines
--- block/vmdk.c | 2 +- tests/qemu-iotests/105 | 70 ++++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/105.out | 21 ++++++++++++++ tests/qemu-iotests/group | 1 + 4 files changed, 93 insertions(+), 1 deletion(-) create mode 100755 tests/qemu-iotests/105 create mode 100644 tests/qemu-iotests/105.out
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan