Skip to content

Commit

Permalink
vmdk: byteswap VMDK4Header.desc_offset field
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
stefanhaRH authored and kevmw committed Jun 17, 2013
1 parent a7cea2b commit 5a394b9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions block/vmdk.c
Expand Up @@ -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) {
Expand Down

0 comments on commit 5a394b9

Please sign in to comment.