diff options
Diffstat (limited to 'block')
-rw-r--r-- | block/qcow.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/block/qcow.c b/block/qcow.c index e60df234c4..e8038e56c8 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -139,6 +139,14 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags, goto fail; } + /* l2_bits specifies number of entries; storing a uint64_t in each entry, + * so bytes = num_entries << 3. */ + if (header.l2_bits < 9 - 3 || header.l2_bits > 16 - 3) { + error_setg(errp, "L2 table size must be between 512 and 64k"); + ret = -EINVAL; + goto fail; + } + if (header.crypt_method > QCOW_CRYPT_AES) { error_setg(errp, "invalid encryption method in qcow header"); ret = -EINVAL; |