diff options
author | Kevin Wolf <kwolf@redhat.com> | 2014-03-26 13:05:35 +0100 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2014-04-01 13:59:47 +0200 |
commit | a9ba36a45dfac645a810c31ce15ab393b69d820a (patch) | |
tree | 6632a9f8471ccb6161a34f07f25ca8ee4d3a4189 /block/bochs.c | |
parent | 8e53abbc20d08ae3ec30c2054e1161314ad9501d (diff) | |
download | qemu-a9ba36a45dfac645a810c31ce15ab393b69d820a.zip qemu-a9ba36a45dfac645a810c31ce15ab393b69d820a.tar.gz qemu-a9ba36a45dfac645a810c31ce15ab393b69d820a.tar.bz2 |
bochs: Fix bitmap offset calculation
32 bit truncation could let us access the wrong offset in the image.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block/bochs.c')
-rw-r--r-- | block/bochs.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/block/bochs.c b/block/bochs.c index a922782..826ec12 100644 --- a/block/bochs.c +++ b/block/bochs.c @@ -186,8 +186,9 @@ static int64_t seek_to_sector(BlockDriverState *bs, int64_t sector_num) return -1; /* not allocated */ } - bitmap_offset = s->data_offset + (512 * s->catalog_bitmap[extent_index] * - (s->extent_blocks + s->bitmap_blocks)); + bitmap_offset = s->data_offset + + (512 * (uint64_t) s->catalog_bitmap[extent_index] * + (s->extent_blocks + s->bitmap_blocks)); /* read in bitmap for current extent */ if (bdrv_pread(bs->file, bitmap_offset + (extent_offset / 8), |