]> Git Repo - qemu.git/commitdiff
qcow2: reject unaligned offsets in write compressed
authorAnton Nefedov <[email protected]>
Tue, 14 Nov 2017 10:16:49 +0000 (13:16 +0300)
committerMax Reitz <[email protected]>
Fri, 17 Nov 2017 17:21:30 +0000 (18:21 +0100)
Misaligned compressed write is not supported.

Signed-off-by: Anton Nefedov <[email protected]>
Message-id: 1510654613[email protected]
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Max Reitz <[email protected]>
block/qcow2.c

index f2731a7cb5d8aa5f53866125f6f8b9f7ed67982c..811b913233742fdaa272d0da3e1e122d6b00246a 100644 (file)
@@ -3358,6 +3358,10 @@ qcow2_co_pwritev_compressed(BlockDriverState *bs, uint64_t offset,
         return bdrv_truncate(bs->file, cluster_offset, PREALLOC_MODE_OFF, NULL);
     }
 
+    if (offset_into_cluster(s, offset)) {
+        return -EINVAL;
+    }
+
     buf = qemu_blockalign(bs, s->cluster_size);
     if (bytes != s->cluster_size) {
         if (bytes > s->cluster_size ||
This page took 0.031865 seconds and 4 git commands to generate.