summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--block/crypto.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/block/crypto.c b/block/crypto.c
index a1139b6f09..00fb40c631 100644
--- a/block/crypto.c
+++ b/block/crypto.c
@@ -518,7 +518,10 @@ static int64_t block_crypto_getlength(BlockDriverState *bs)
uint64_t offset = qcrypto_block_get_payload_offset(crypto->block);
assert(offset < INT64_MAX);
- assert(offset < len);
+
+ if (offset > len) {
+ return -EIO;
+ }
len -= offset;