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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Date:	Fri, 14 Dec 2012 00:04:27 +0200
From:	Sami Liedes <sami.liedes@....fi>
To:	linux-ext4@...r.kernel.org
Subject: [PATCH 5/8] e2fsck/revoke.c: Fix undefined behavior in hash()

There's a shift by (hash_shift - 12) in hash(), but hash() is called
with hash_shift=10, resulting in a negative shift and thus undefined
behavior.

A simple and stupid minimal fix is to just change the subtracted
amount to 10.

Caught by clang -fsanitize=undefined.

Signed-off-by: Sami Liedes <sami.liedes@....fi>
---
 e2fsck/revoke.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/e2fsck/revoke.c b/e2fsck/revoke.c
index 38c265e..dddef4d 100644
--- a/e2fsck/revoke.c
+++ b/e2fsck/revoke.c
@@ -115,7 +115,7 @@ static inline int hash(journal_t *journal, unsigned long block)
 
 	return ((block << (hash_shift - 6)) ^
 		(block >> 13) ^
-		(block << (hash_shift - 12))) & (table->hash_size - 1);
+		(block << (hash_shift - 10))) & (table->hash_size - 1);
 }
 
 static int insert_revoke_hash(journal_t *journal, unsigned long blocknr,
-- 
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ