From d1319b077a4bd980ca1b8a167b02b519330dd26b Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Tue, 23 Sep 2014 09:56:21 +0800 Subject: 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 Reviewed-by: Max Reitz Signed-off-by: Fam Zheng Message-id: 1411437381-11234-1-git-send-email-famz@redhat.com Signed-off-by: Stefan Hajnoczi --- block/vmdk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'block/vmdk.c') diff --git a/block/vmdk.c b/block/vmdk.c index afdea1a..4ae6c75 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -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; -- cgit v1.1