From: Kevin Wolf Date: Wed, 26 Mar 2014 12:05:35 +0000 (+0100) Subject: bochs: Fix bitmap offset calculation X-Git-Tag: v1.7.2~75 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6ee0d5fdc7bbeb5419fb41fd949fd0b0ebe085db;p=thirdparty%2Fqemu.git bochs: Fix bitmap offset calculation 32 bit truncation could let us access the wrong offset in the image. Signed-off-by: Kevin Wolf Reviewed-by: Stefan Hajnoczi Reviewed-by: Max Reitz Signed-off-by: Stefan Hajnoczi (cherry picked from commit a9ba36a45dfac645a810c31ce15ab393b69d820a) Signed-off-by: Michael Roth --- diff --git a/block/bochs.c b/block/bochs.c index 0ec980a3a54..5c742239648 100644 --- a/block/bochs.c +++ b/block/bochs.c @@ -185,8 +185,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),