Commit 3e3b838f authored by Anton Nefedov's avatar Anton Nefedov Committed by Max Reitz
Browse files

qcow2: reject unaligned offsets in write compressed



Misaligned compressed write is not supported.

Signed-off-by: default avatarAnton Nefedov <anton.nefedov@virtuozzo.com>
Message-id: 1510654613-47868-2-git-send-email-anton.nefedov@virtuozzo.com
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
parent 2b773193
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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 ||