]> xenbits.xensource.com Git - qemu-upstream-unstable.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>
Sun, 22 Feb 2015 18:09:44 +0000 (12:09 -0600)
commit1e85e69fd6972d1990c6309dfa273ccd8b12d92a
treef94f51294a9091de42a21aaf6d2ff9889a7bc486
parentff15187eca2d70cbd3f9352441920d9a545198e0
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