OSDN Git Service

qcow2: Avoid overflow in alloc_clusters_noref()
authorMax Reitz <mreitz@redhat.com>
Tue, 29 Apr 2014 17:03:11 +0000 (19:03 +0200)
committerKevin Wolf <kwolf@redhat.com>
Wed, 30 Apr 2014 12:46:13 +0000 (14:46 +0200)
commit91f827dcff61c3e007def4c949d3a8310954b85e
treeb33046c00ba2467efb8a619f4c12e9f242d9b6fa
parent35d0d40a034b2392f48f91e4e00c8c94e3526a19
qcow2: Avoid overflow in alloc_clusters_noref()

alloc_clusters_noref() stores the cluster index in a uint64_t. However,
offsets are often represented as int64_t (as for example the return
value of alloc_clusters_noref() itself demonstrates). Therefore, we
should make sure all offsets in the allocated range of clusters are
representable using int64_t without overflows.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/qcow2-refcount.c