]> git.proxmox.com Git - mirror_qemu.git/commit - block/crypto.c
luks: Turn invalid assertion into check
authorKevin Wolf <kwolf@redhat.com>
Mon, 5 Mar 2018 16:39:31 +0000 (17:39 +0100)
committerKevin Wolf <kwolf@redhat.com>
Mon, 19 Mar 2018 11:01:24 +0000 (12:01 +0100)
commite39e959e89b33bc0e17a702db42ea8a5f3763133
treeea094c29624392293206da065ebe7756d34dd615
parent1bedcaf120c128e9f565185171d378f8846d1567
luks: Turn invalid assertion into check

The .bdrv_getlength implementation of the crypto block driver asserted
that the payload offset isn't after EOF. This is an invalid assertion to
make as the image file could be corrupted. Instead, check it and return
-EIO if the file is too small for the payload offset.

Zero length images are fine, so trigger -EIO only on offset > len, not
on offset >= len as the assertion did before.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
block/crypto.c