thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

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

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