[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 25/28: SETU: avoid 64-bit shift on 64-bit value.
From: |
gnunet |
Subject: |
[gnunet] 25/28: SETU: avoid 64-bit shift on 64-bit value. |
Date: |
Mon, 06 Feb 2023 06:19:27 +0100 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository gnunet.
commit 7341cdfb5bef6abaf4e12c91d016a940e201e8b7
Author: ulfvonbelow <strilen@tilde.club>
AuthorDate: Sun Jan 29 05:26:48 2023 -0600
SETU: avoid 64-bit shift on 64-bit value.
Shifting a 64-bit value by any more than 63 bits is undefined behavior,
apparently - at least, the sanitizers complain about it. The intuitive,
obvious result, of course, is for the result to be 0. In this case, when s
==
0, x << (64 - s) should result in 0, and (x >> s) should result in x, and
the
bitwise-or of those two should be x. Which x already was.
Perhaps it should be investigated whether (x >> (64 - s)) should actually
be (x >> (63 - s)), since 0 <= s < 64.
Signed-off-by: Martin Schanzenbach <schanzen@gnunet.org>
---
src/setu/gnunet-service-setu_strata_estimator.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/setu/gnunet-service-setu_strata_estimator.c
b/src/setu/gnunet-service-setu_strata_estimator.c
index 7981cc847..43ccf3afd 100644
--- a/src/setu/gnunet-service-setu_strata_estimator.c
+++ b/src/setu/gnunet-service-setu_strata_estimator.c
@@ -85,7 +85,8 @@ salt_key (const struct IBF_Key *k_in,
uint64_t x = k_in->key_val;
/* rotate ibf key */
- x = (x >> s) | (x << (64 - s));
+ if (s > 0)
+ x = (x >> s) | (x << (64 - s));
k_out->key_val = x;
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnunet] 05/28: -DATACACHE: fix memory leaks in tests., (continued)
- [gnunet] 05/28: -DATACACHE: fix memory leaks in tests., gnunet, 2023/02/06
- [gnunet] 07/28: FS: fix memory leak in GNUNET_FS_search_stop., gnunet, 2023/02/06
- [gnunet] 09/28: GNSRECORD: fix memory leaks in tests., gnunet, 2023/02/06
- [gnunet] 16/28: NAMESTORE: avoid use-after-free in handle_record_result., gnunet, 2023/02/06
- [gnunet] 15/28: NAMESTORE: fix overread in handle_record_store., gnunet, 2023/02/06
- [gnunet] 13/28: -NAMESTORE: fix memory leaks in tests., gnunet, 2023/02/06
- [gnunet] 14/28: NAMESTORE: fix memory leak in parse_recordline., gnunet, 2023/02/06
- [gnunet] 10/28: -HELLO: fix memory leaks in tests., gnunet, 2023/02/06
- [gnunet] 27/28: SETU: prevent misaligned access to StrataEstimatorMessage.set_size., gnunet, 2023/02/06
- [gnunet] 23/28: REVOCATION: don't leak signature purpose memory., gnunet, 2023/02/06
- [gnunet] 25/28: SETU: avoid 64-bit shift on 64-bit value.,
gnunet <=
- [gnunet] 28/28: SETU: don't leak Operation.{message_control_flow,inquiries_sent}., gnunet, 2023/02/06
- [gnunet] 19/28: RECLAIM: fix 1-byte overflow in DID_did_to_pkey., gnunet, 2023/02/06
- [gnunet] 22/28: TESTBED: don't leak helper_argv when SSH can't be executed., gnunet, 2023/02/06
- [gnunet] 24/28: REST: don't leak basic_auth_file., gnunet, 2023/02/06
- [gnunet] 26/28: -SECRETSHARING: don't leak my_share in test., gnunet, 2023/02/06
- [gnunet] 20/28: RECLAIM: don't leak the elements of attr_list., gnunet, 2023/02/06
- [gnunet] 21/28: -RECLAIM: fix memory leaks in tests., gnunet, 2023/02/06