]> www.infradead.org Git - users/dwmw2/qemu.git/commit
qcow2: Prevent numerical overflow
authorMax Reitz <mreitz@redhat.com>
Tue, 2 Dec 2014 17:32:50 +0000 (18:32 +0100)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Wed, 7 Jan 2015 21:11:53 +0000 (15:11 -0600)
commit175117c1592cdc9de8174b64e90e3dff22087d8e
treef4e80a2d49e54f91d632782b04597187840aeb5b
parentaa58eedb35793e03584523d2d064f83bc45b67d1
qcow2: Prevent numerical overflow

In qcow2_alloc_cluster_offset(), *num is limited to
INT_MAX >> BDRV_SECTOR_BITS by all callers. However, since remaining is
of type uint64_t, we might as well cast *num to that type before
performing the shift.

Cc: qemu-stable@nongnu.org
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 11c89769dc3e638ef72915d97058411ddf79b64b)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
block/qcow2-cluster.c