From: Anton Nefedov <anton.nefe...@virtuozzo.com> Misaligned compressed write is not supported.
Signed-off-by: Anton Nefedov <anton.nefe...@virtuozzo.com> Message-id: 1510654613-47868-2-git-send-email-anton.nefe...@virtuozzo.com Reviewed-by: Eric Blake <ebl...@redhat.com> Signed-off-by: Max Reitz <mre...@redhat.com> --- block/qcow2.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/qcow2.c b/block/qcow2.c index f2731a7cb5..811b913233 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -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 || -- 2.13.6