Message ID | 1399662217-31148-2-git-send-email-stefanha@redhat.com |
---|---|
State | New |
Headers | show |
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index e79895d..9507aef 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -656,7 +656,9 @@ retry: /* Make sure that all offsets in the "allocated" range are representable * in an int64_t */ - if (s->free_cluster_index - 1 > (INT64_MAX >> s->cluster_bits)) { + if (s->free_cluster_index > 0 && + s->free_cluster_index - 1 > (INT64_MAX >> s->cluster_bits)) + { return -EFBIG; }