]> Git Repo - qemu.git/commitdiff
qcow2: Fix potential qemu-img check crash on 32 bit hosts
authorKevin Wolf <[email protected]>
Tue, 1 Dec 2015 14:16:49 +0000 (15:16 +0100)
committerKevin Wolf <[email protected]>
Wed, 2 Dec 2015 12:22:29 +0000 (13:22 +0100)
This crash was caught with qemu-iotests test case 138.

Commit b6d36de already fixed a few 32 bit truncation bugs that could
cause qemu-img check to allocate too little memory and consequently
it would segfault. On 32 bit hosts, there is one more place that needs
to be fixed because size_t was involved in the calculation and is a
32 bit type there.

Cc: [email protected]
Reported-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
Tested-by: Michael S. Tsirkin <[email protected]>
block/qcow2-refcount.c

index 6e0e5bd9aebb81028fb3834c76b73bab91b0edec..820f412ab67128d89e0efb4489adc86e9f7be3b7 100644 (file)
@@ -1244,7 +1244,7 @@ fail:
 /* refcount checking functions */
 
 
-static size_t refcount_array_byte_size(BDRVQcow2State *s, uint64_t entries)
+static uint64_t refcount_array_byte_size(BDRVQcow2State *s, uint64_t entries)
 {
     /* This assertion holds because there is no way we can address more than
      * 2^(64 - 9) clusters at once (with cluster size 512 = 2^9, and because
This page took 0.032011 seconds and 4 git commands to generate.