qemu-img will complain when qcow or qcow2
size overflow for 64 bits, report the right
message in this condition.

Signed-off-by: liguang <lig.f...@cn.fujitsu.com>
---
 qemu-img.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/qemu-img.c b/qemu-img.c
index e29e01b..f3209b4 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -353,6 +353,11 @@ static int img_create(int argc, char **argv)
             ret = -1;
             goto out;
         }
+        if (sval == 0) {
+            error_report("Image size must be less than 8 exabytes!");
+            ret = -1;
+            goto out;
+        }
         img_size = (uint64_t)sval;
     }
 
-- 
1.7.2.5


Reply via email to