]> git.proxmox.com Git - mirror_qemu.git/commit
qemu-img: avoid overflow of min_sparse parameter
authorPeter Lieven <pl@kamp.de>
Fri, 13 Jul 2018 07:15:39 +0000 (09:15 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 23 Jul 2018 19:23:30 +0000 (14:23 -0500)
commit3afe55ff387d95e1245ea095a7d0734b9ada265a
tree842c63babceabbf269d9d8c2b2f9cddfeb650f56
parent1b817abcd4dbb8c0db98fdd9f4f805a50c45e1bb
qemu-img: avoid overflow of min_sparse parameter

the min_sparse convert parameter can overflow (e.g. -S 1024G)
in the conversion from int64_t to int resulting in a negative
min_sparse parameter. Avoid this by limiting the valid parameters
to sane values. In fact anything exceeding the convert buffer size
is also pointless. While at it also forbid values that are non
multiple of 512 to avoid undesired behaviour. For instance, values
between 1 and 511 were legal, but resulted in full allocation.

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 6360ab278cc1ac3e1235e0755e4cba1f918e6f3c)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
qemu-img.c