cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-vmdk-Widen-before-shifting-32-bit-header-field.patch

9ae3a8
From 649835536d4bb1366e01ff5600d3005042dd50d5 Mon Sep 17 00:00:00 2001
9ae3a8
From: Fam Zheng <famz@redhat.com>
9ae3a8
Date: Mon, 15 Feb 2016 09:28:24 +0100
9ae3a8
Subject: [PATCH 11/18] vmdk: Widen before shifting 32 bit header field
9ae3a8
9ae3a8
RH-Author: Fam Zheng <famz@redhat.com>
9ae3a8
Message-id: <1455528511-9357-12-git-send-email-famz@redhat.com>
9ae3a8
Patchwork-id: 69177
9ae3a8
O-Subject: [RHEL-7.3 qemu-kvm PATCH 11/18] vmdk: Widen before shifting 32 bit header field
9ae3a8
Bugzilla: 1299250
9ae3a8
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
RH-Acked-by: Max Reitz <mreitz@redhat.com>
9ae3a8
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
9ae3a8
9ae3a8
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1299250
9ae3a8
9ae3a8
Coverity spotted this.
9ae3a8
9ae3a8
The field is 32 bits, but if it's possible to overflow in 32 bit
9ae3a8
left shift.
9ae3a8
9ae3a8
Signed-off-by: Fam Zheng <famz@redhat.com>
9ae3a8
Reviewed-by: John Snow <jsnow@redhat.com>
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
(cherry picked from commit 7237aecd7e8fcc3ccf7fded77b6c127b4df5d3ac)
9ae3a8
Signed-off-by: Fam Zheng <famz@redhat.com>
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 block/vmdk.c | 2 +-
9ae3a8
 1 file changed, 1 insertion(+), 1 deletion(-)
9ae3a8
9ae3a8
diff --git a/block/vmdk.c b/block/vmdk.c
9ae3a8
index 32b3d4c..3810d75 100644
9ae3a8
--- a/block/vmdk.c
9ae3a8
+++ b/block/vmdk.c
9ae3a8
@@ -525,7 +525,7 @@ static int vmdk_open_vmfs_sparse(BlockDriverState *bs,
9ae3a8
     }
9ae3a8
     ret = vmdk_add_extent(bs, file, false,
9ae3a8
                           le32_to_cpu(header.disk_sectors),
9ae3a8
-                          le32_to_cpu(header.l1dir_offset) << 9,
9ae3a8
+                          (int64_t)le32_to_cpu(header.l1dir_offset) << 9,
9ae3a8
                           0,
9ae3a8
                           le32_to_cpu(header.l1dir_size),
9ae3a8
                           4096,
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8