]> xenbits.xensource.com Git - qemu-upstream-4.4-testing.git/commitdiff
vmdk: refuse to open higher version than supported
authorFam Zheng <famz@redhat.com>
Thu, 13 Jun 2013 03:21:29 +0000 (11:21 +0800)
committerStefan Hajnoczi <stefanha@redhat.com>
Mon, 24 Jun 2013 08:25:43 +0000 (10:25 +0200)
Refuse to open higher version for safety.

Although we try to be compatible with published VMDK spec, VMware has
newer version from ESXi 5.1 exported OVF/OVA, which we have no knowledge
what's changed in it. And it is very likely to have more new versions in
the future, so it's not safe to open them blindly.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block/vmdk.c

index 65ae0119c4cfd9305f3b69d924e26fb86d1b5533..975e1d41ffedaa85bc50a3ab3aa0334bf3a7caff 100644 (file)
@@ -561,6 +561,15 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,
         header = footer.header;
     }
 
+    if (le32_to_cpu(header.version) >= 3) {
+        char buf[64];
+        snprintf(buf, sizeof(buf), "VMDK version %d",
+                 le32_to_cpu(header.version));
+        qerror_report(QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
+                bs->device_name, "vmdk", buf);
+        return -ENOTSUP;
+    }
+
     l1_entry_sectors = le32_to_cpu(header.num_gtes_per_gte)
                         * le64_to_cpu(header.granularity);
     if (l1_entry_sectors == 0) {