diff options
author | Max Reitz <mreitz@redhat.com> | 2014-03-07 23:10:12 +0100 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2014-03-13 14:23:27 +0100 |
commit | 26d49c46750aff62c8c6e7a8b14c79d4114a8e53 (patch) | |
tree | 4216a8ea7edb623480dfcc839598b683c969810a /block | |
parent | 750036a848ea913ba6343718ffa70da98f7eef6b (diff) | |
download | qemu-26d49c46750aff62c8c6e7a8b14c79d4114a8e53.zip qemu-26d49c46750aff62c8c6e7a8b14c79d4114a8e53.tar.gz qemu-26d49c46750aff62c8c6e7a8b14c79d4114a8e53.tar.bz2 |
qcow2-refcount: Sanitize refcount table entry
When reading the refcount table entry in get_refcount(), only bits which
are actually significant for the refcount block offset should be taken
into account.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/qcow2-refcount.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index 8712d8b..6151148 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -96,7 +96,8 @@ static int get_refcount(BlockDriverState *bs, int64_t cluster_index) refcount_table_index = cluster_index >> (s->cluster_bits - REFCOUNT_SHIFT); if (refcount_table_index >= s->refcount_table_size) return 0; - refcount_block_offset = s->refcount_table[refcount_table_index]; + refcount_block_offset = + s->refcount_table[refcount_table_index] & REFT_OFFSET_MASK; if (!refcount_block_offset) return 0; |