aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2013-06-10 11:07:33 +0200
committerKevin Wolf <kwolf@redhat.com>2013-06-17 17:47:59 +0200
commit5a394b9e96eb3c39676353bdf8a230180ae8d6f4 (patch)
treed659d984fe3e6d3353b1a27cc13847ffbdce7f9a /block
parenta7cea2ba47ea6d361584072f96d7858f5cc99009 (diff)
downloadqemu-5a394b9e96eb3c39676353bdf8a230180ae8d6f4.zip
qemu-5a394b9e96eb3c39676353bdf8a230180ae8d6f4.tar.gz
qemu-5a394b9e96eb3c39676353bdf8a230180ae8d6f4.tar.bz2
vmdk: byteswap VMDK4Header.desc_offset field
Remember to byteswap VMDK4Header.desc_offset on big-endian machines. Cc: qemu-stable@nongnu.org Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/vmdk.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/block/vmdk.c b/block/vmdk.c
index 608daaf..ee50a73 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -507,8 +507,11 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,
if (ret < 0) {
return ret;
}
- if (header.capacity == 0 && header.desc_offset) {
- return vmdk_open_desc_file(bs, flags, header.desc_offset << 9);
+ if (header.capacity == 0) {
+ int64_t desc_offset = le64_to_cpu(header.desc_offset);
+ if (desc_offset) {
+ return vmdk_open_desc_file(bs, flags, desc_offset << 9);
+ }
}
if (le64_to_cpu(header.gd_offset) == VMDK4_GD_AT_END) {