From: David Woodhouse <dwmw2@infradead.org>
To: qemu-devel <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [PATCH] Fix 32-bit overflow in parallels image support
Date: Sat, 07 Nov 2009 14:10:01 +0000 [thread overview]
Message-ID: <1257603001.30774.127.camel@macbook.infradead.org> (raw)
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
diff --git a/block/parallels.c b/block/parallels.c
index 0b64a5c..63b6738 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -119,7 +119,8 @@ fail:
static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num)
{
BDRVParallelsState *s = bs->opaque;
- uint32_t index, offset, position;
+ uint32_t index, offset;
+ uint64_t position;
index = sector_num / s->tracks;
offset = sector_num % s->tracks;
@@ -128,7 +129,7 @@ static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num)
if ((index > s->catalog_size) || (s->catalog_bitmap[index] == 0))
return -1;
- position = (s->catalog_bitmap[index] + offset) * 512;
+ position = (uint64_t)(s->catalog_bitmap[index] + offset) * 512;
// fprintf(stderr, "sector: %llx index=%x offset=%x pointer=%x position=%x\n",
// sector_num, index, offset, s->catalog_bitmap[index], position);
--
David Woodhouse Open Source Technology Centre
David.Woodhouse@intel.com Intel Corporation
reply other threads:[~2009-11-07 14:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1257603001.30774.127.camel@macbook.infradead.org \
--to=dwmw2@infradead.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).