Blame SOURCES/e2fsprogs-1.45.6-e2image-fix-overflow-in-l2-table-processing.patch

a77133
From 1a97380b1cc4d167697e31e5fb663e805629c1ab Mon Sep 17 00:00:00 2001
a77133
From: Artem Blagodarenko <artem.blagodarenko@gmail.com>
a77133
Date: Thu, 22 Apr 2021 01:24:48 -0400
a77133
Subject: [PATCH 25/46] e2image: fix overflow in l2 table processing
a77133
Content-Type: text/plain
a77133
a77133
For a large partition during e2image capture process
a77133
it is possible to overflow offset at multiply operation.
a77133
This leads to the situation when data is written to the
a77133
position at the start of the image instead of the image end.
a77133
a77133
Let's use the right cast to avoid integer overflow.
a77133
a77133
Signed-off-by: Alexey Lyashkov <c17817@cray.com>
a77133
Signed-off-by: Artem Blagodarenko <c17828@cray.com>
a77133
HPE-bug-id: LUS-9368
a77133
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
a77133
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
a77133
---
a77133
 lib/ext2fs/qcow2.c | 2 +-
a77133
 1 file changed, 1 insertion(+), 1 deletion(-)
a77133
a77133
diff --git a/lib/ext2fs/qcow2.c b/lib/ext2fs/qcow2.c
a77133
index ee701f7a..20824170 100644
a77133
--- a/lib/ext2fs/qcow2.c
a77133
+++ b/lib/ext2fs/qcow2.c
a77133
@@ -238,7 +238,7 @@ int qcow2_write_raw_image(int qcow2_fd, int raw_fd,
a77133
 			if (offset == 0)
a77133
 				continue;
a77133
 
a77133
-			off_out = (l1_index * img.l2_size) +
a77133
+			off_out = ((__u64)l1_index * img.l2_size) +
a77133
 				  l2_index;
a77133
 			off_out <<= img.cluster_bits;
a77133
 			ret = qcow2_copy_data(qcow2_fd, raw_fd, offset,
a77133
-- 
a77133
2.35.1
a77133