From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41559) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4Z6q-0004ly-AT for qemu-devel@nongnu.org; Tue, 08 Jul 2014 13:24:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X4Z6B-0000nW-K1 for qemu-devel@nongnu.org; Tue, 08 Jul 2014 13:23:16 -0400 Received: from e8.ny.us.ibm.com ([32.97.182.138]:49947) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4Z6B-0000nK-FC for qemu-devel@nongnu.org; Tue, 08 Jul 2014 13:22:35 -0400 Received: from /spool/local by e8.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 8 Jul 2014 13:22:35 -0400 From: Michael Roth Date: Tue, 8 Jul 2014 12:17:52 -0500 Message-Id: <1404839947-1086-82-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1404839947-1086-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1404839947-1086-1-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 081/156] bochs: Fix bitmap offset calculation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org 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 (cherry picked from commit a9ba36a45dfac645a810c31ce15ab393b69d820a) Signed-off-by: Michael Roth --- block/bochs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/block/bochs.c b/block/bochs.c index 0ec980a..5c74223 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), -- 1.9.1