From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41969) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WV2Me-0000vV-0U for qemu-devel@nongnu.org; Tue, 01 Apr 2014 13:20:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WV2MX-0003CG-JQ for qemu-devel@nongnu.org; Tue, 01 Apr 2014 13:20:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24493) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WV2MX-0003C8-Bw for qemu-devel@nongnu.org; Tue, 01 Apr 2014 13:20:37 -0400 From: Stefan Hajnoczi Date: Tue, 1 Apr 2014 19:18:54 +0200 Message-Id: <1396372769-11688-17-git-send-email-stefanha@redhat.com> In-Reply-To: <1396372769-11688-1-git-send-email-stefanha@redhat.com> References: <1396372769-11688-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PULL for-2.0 16/51] bochs: Fix bitmap offset calculation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Peter Maydell , Stefan Hajnoczi From: Kevin Wolf 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 --- block/bochs.c | 5 +++-- 1 file 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), -- 1.9.0