vmdk: Fix integer overflow in offset calculation
PATCH v3 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]>
Signed-off-by Fam Zheng <[email protected]>
---
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 ++++++++++++++ 3 files changed, 92 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 4398046511104 +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 4398046511104 +4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +*** done
Signature · 1 line
1.9.3
Quoted 1 line · Fam Zheng
+# Copyright (C) 1014 Red Hat, Inc.
Oops! Resending...
Fam