diff options
author | Max Reitz <mreitz@redhat.com> | 2016-06-15 17:36:30 +0200 |
---|---|---|
committer | Max Reitz <mreitz@redhat.com> | 2016-07-13 13:41:38 +0200 |
commit | 84c26520d3c1c9ff4a10455748139463278816d5 (patch) | |
tree | ae6857d2b67c1a596c6e62271ac9a7e66111240b /block/qcow2-cluster.c | |
parent | bcf23482ae00e040dbef46c44ff914bf788a0937 (diff) |
qcow2: Avoid making the L1 table too big
We refuse to open images whose L1 table we deem "too big". Consequently,
we should not produce such images ourselves.
Cc: qemu-stable@nongnu.org
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20160615153630.2116-3-mreitz@redhat.com
Reviewed-by: Eric Blake <eblake@redhat.com>
[mreitz: Added QEMU_BUILD_BUG_ON()]
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block/qcow2-cluster.c')
-rw-r--r-- | block/qcow2-cluster.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index 6b92ce9429..00c16dcba5 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -65,7 +65,8 @@ int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t min_size, } } - if (new_l1_size > INT_MAX / sizeof(uint64_t)) { + QEMU_BUILD_BUG_ON(QCOW_MAX_L1_SIZE > INT_MAX); + if (new_l1_size > QCOW_MAX_L1_SIZE / sizeof(uint64_t)) { return -EFBIG; } |