Blame SOURCES/0012-fs-ntfs3-Fix-integer-overflow-in-multiplication.patch

Kmods SIG 8b815c
From 71eeb6ace80be7389d942b9647765417e5b039f7 Mon Sep 17 00:00:00 2001
Kmods SIG 8b815c
From: Colin Ian King <colin.king@canonical.com>
Kmods SIG 8b815c
Date: Mon, 16 Aug 2021 17:30:25 +0100
Kmods SIG 8b815c
Subject: [Backport 71eeb6ace80b] src: Fix integer overflow in
Kmods SIG 8b815c
 multiplication
Kmods SIG 8b815c
Kmods SIG 8b815c
The multiplication of the u32 data_size with a int is being performed
Kmods SIG 8b815c
using 32 bit arithmetic however the results is being assigned to the
Kmods SIG 8b815c
variable nbits that is a size_t (64 bit) value. Fix a potential
Kmods SIG 8b815c
integer overflow by casting the u32 value to a size_t before the
Kmods SIG 8b815c
multiply to use a size_t sized bit multiply operation.
Kmods SIG 8b815c
Kmods SIG 8b815c
Addresses-Coverity: ("Unintentional integer overflow")
Kmods SIG 8b815c
Fixes: 82cae269cfa9 ("src: Add initialization of super block")
Kmods SIG 8b815c
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Kmods SIG 8b815c
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Kmods SIG 8b815c
---
Kmods SIG 8b815c
 src/index.c | 2 +-
Kmods SIG 8b815c
 1 file changed, 1 insertion(+), 1 deletion(-)
Kmods SIG 8b815c
Kmods SIG 8b815c
diff --git a/src/index.c b/src/index.c
Kmods SIG 8b815c
index 6aa9540ece4728b5a02108924db76b4ee920a353..9386c551e208204870363685b27826ccb60e1171 100644
Kmods SIG 8b815c
--- a/src/index.c
Kmods SIG 8b815c
+++ b/src/index.c
Kmods SIG 8b815c
@@ -2012,7 +2012,7 @@ static int indx_shrink(struct ntfs_index *indx, struct ntfs_inode *ni,
Kmods SIG 8b815c
 		unsigned long pos;
Kmods SIG 8b815c
 		const unsigned long *bm = resident_data(b);
Kmods SIG 8b815c
 
Kmods SIG 8b815c
-		nbits = le32_to_cpu(b->res.data_size) * 8;
Kmods SIG 8b815c
+		nbits = (size_t)le32_to_cpu(b->res.data_size) * 8;
Kmods SIG 8b815c
 
Kmods SIG 8b815c
 		if (bit >= nbits)
Kmods SIG 8b815c
 			return 0;
Kmods SIG 8b815c
-- 
Kmods SIG 8b815c
2.31.1
Kmods SIG 8b815c