peterdelevoryas / rpms / qemu

Forked from rpms/qemu 2 years ago
Clone

Blame qemu-parallels-image-format-overflow.patch

Mark McLoughlin 018bb5
From ff1a1e986f2e167c2538160d0476ac61cda31f77 Mon Sep 17 00:00:00 2001
Mark McLoughlin 018bb5
From: David Woodhouse <dwmw2@infradead.org>
Mark McLoughlin 018bb5
Date: Sat, 7 Nov 2009 14:10:01 +0000
Mark McLoughlin 018bb5
Subject: [PATCH] Fix 32-bit overflow in parallels image support
Mark McLoughlin 018bb5
Mark McLoughlin 018bb5
(cherry picked from commit c34d2451ed32651e14e309f94009be07d231ee96)
Mark McLoughlin 018bb5
Mark McLoughlin 018bb5
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Mark McLoughlin 018bb5
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Mark McLoughlin 018bb5
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Mark McLoughlin 018bb5
Fedora-patch: qemu-parallels-image-format-overflow.patch
Mark McLoughlin 018bb5
---
Mark McLoughlin 018bb5
 block/parallels.c |    5 +++--
Mark McLoughlin 018bb5
 1 files changed, 3 insertions(+), 2 deletions(-)
Mark McLoughlin 018bb5
Mark McLoughlin 018bb5
diff --git a/block/parallels.c b/block/parallels.c
Mark McLoughlin 018bb5
index 0b64a5c..63b6738 100644
Mark McLoughlin 018bb5
--- a/block/parallels.c
Mark McLoughlin 018bb5
+++ b/block/parallels.c
Mark McLoughlin 018bb5
@@ -119,7 +119,8 @@ fail:
Mark McLoughlin 018bb5
 static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num)
Mark McLoughlin 018bb5
 {
Mark McLoughlin 018bb5
     BDRVParallelsState *s = bs->opaque;
Mark McLoughlin 018bb5
-    uint32_t index, offset, position;
Mark McLoughlin 018bb5
+    uint32_t index, offset;
Mark McLoughlin 018bb5
+    uint64_t position;
Mark McLoughlin 018bb5
 
Mark McLoughlin 018bb5
     index = sector_num / s->tracks;
Mark McLoughlin 018bb5
     offset = sector_num % s->tracks;
Mark McLoughlin 018bb5
@@ -128,7 +129,7 @@ static inline int seek_to_sector(BlockDriverState *bs, int64_t sector_num)
Mark McLoughlin 018bb5
     if ((index > s->catalog_size) || (s->catalog_bitmap[index] == 0))
Mark McLoughlin 018bb5
 	return -1;
Mark McLoughlin 018bb5
 
Mark McLoughlin 018bb5
-    position = (s->catalog_bitmap[index] + offset) * 512;
Mark McLoughlin 018bb5
+    position = (uint64_t)(s->catalog_bitmap[index] + offset) * 512;
Mark McLoughlin 018bb5
 
Mark McLoughlin 018bb5
 //    fprintf(stderr, "sector: %llx index=%x offset=%x pointer=%x position=%x\n",
Mark McLoughlin 018bb5
 //	sector_num, index, offset, s->catalog_bitmap[index], position);
Mark McLoughlin 018bb5
-- 
Mark McLoughlin 018bb5
1.6.2.5
Mark McLoughlin 018bb5