lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Tue,  2 Apr 2024 23:00:26 +0500
From: Sabyrzhan Tasbolatov <snovitoll@...il.com>
To: konishi.ryusuke@...il.com,
	linux-nilfs@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
	snovitoll@...il.com
Subject: [PATCH] fs/nilfs2: prevent int overflow in btree binary search

Should prevent int overflow if low + high > INT_MAX in big btree with
nchildren in nilfs_btree_node_lookup() binary search.

Signed-off-by: Sabyrzhan Tasbolatov <snovitoll@...il.com>
---
 fs/nilfs2/btree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c
index 65659fa03..39ee4fe11 100644
--- a/fs/nilfs2/btree.c
+++ b/fs/nilfs2/btree.c
@@ -300,7 +300,7 @@ static int nilfs_btree_node_lookup(const struct nilfs_btree_node *node,
 	index = 0;
 	s = 0;
 	while (low <= high) {
-		index = (low + high) / 2;
+		index = low + (high - low) / 2;
 		nkey = nilfs_btree_node_get_key(node, index);
 		if (nkey == key) {
 			s = 0;
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ