]> Git Repo - qemu.git/blobdiff - block/vmdk.c
qobject: Use qobject_to() instead of type cast
[qemu.git] / block / vmdk.c
index f94c49a9c0d8e734289fc4e61d72df813cbe4bcf..84f8bbe480cbf944e87145af0b3bbd0617d52a80 100644 (file)
@@ -47,6 +47,8 @@
 #define VMDK4_FLAG_MARKER (1 << 17)
 #define VMDK4_GD_AT_END 0xffffffffffffffffULL
 
+#define VMDK_EXTENT_MAX_SECTORS (1ULL << 32)
+
 #define VMDK_GTE_ZEROED 0x1
 
 /* VMDK internal error codes */
@@ -1250,6 +1252,10 @@ static int get_cluster_offset(BlockDriverState *bs,
             return zeroed ? VMDK_ZEROED : VMDK_UNALLOC;
         }
 
+        if (extent->next_cluster_sector >= VMDK_EXTENT_MAX_SECTORS) {
+            return VMDK_ERROR;
+        }
+
         cluster_sector = extent->next_cluster_sector;
         extent->next_cluster_sector += extent->cluster_sectors;
 
This page took 0.023945 seconds and 4 git commands to generate.