aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2018-03-20 17:07:58 +0100
committerKevin Wolf <kwolf@redhat.com>2018-03-26 12:17:43 +0200
commit2332d82589ef9e9f7e065ec1f759a2c164ad4932 (patch)
treed2fb14f4a462cccac8fea81a86d4949a193982b0
parent50880f25c88f2a629bd68a5fb1a46aa9bf0a2543 (diff)
parallels: Check maximum cluster size on create
It's unclear what the real maximum cluster size is for the Parallels format, but let's at least make sure that we don't get integer overflows in our .bdrv_co_create implementation. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
-rw-r--r--block/parallels.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/block/parallels.c b/block/parallels.c
index e2515dec81..799215e079 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -526,6 +526,11 @@ static int coroutine_fn parallels_co_create(BlockdevCreateOptions* opts,
cl_size = DEFAULT_CLUSTER_SIZE;
}
+ /* XXX What is the real limit here? This is an insanely large maximum. */
+ if (cl_size >= INT64_MAX / MAX_PARALLELS_IMAGE_FACTOR) {
+ error_setg(errp, "Cluster size is too large");
+ return -EINVAL;
+ }
if (total_size >= MAX_PARALLELS_IMAGE_FACTOR * cl_size) {
error_setg(errp, "Image size is too large for this cluster size");
return -E2BIG;