[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Avoid integer error in TEST_BITOPS tests
commit 10ea3343b52104d9a1f81f2b0ff25e7c0d733fef
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Tue Sep 19 13:58:35 2017 -0400
Avoid integer error in TEST_BITOPS tests
If "1" is not 64 bits wide already, then "1 << i" will not actually
work.
This bug only affects the TEST_BITOPS code, and shouldn't matter for
the actual use of the timeout code (except if/when it causes this
test to fail).
Reported by dcb314@xxxxxxxxxxx. Fix for bug 23583. Not adding a
changes file, since this code is never compiled into Tor.
---
src/ext/timeouts/timeout-bitops.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/ext/timeouts/timeout-bitops.c b/src/ext/timeouts/timeout-bitops.c
index a018f33b9..e99af8f9c 100644
--- a/src/ext/timeouts/timeout-bitops.c
+++ b/src/ext/timeouts/timeout-bitops.c
@@ -231,7 +231,8 @@ main(int c, char **v)
int result = 0;
for (i = 0; i <= 63; ++i) {
- uint64_t x = 1 << i;
+ uint64_t x = 1;
+ x <<= i;
if (!check(x))
result = 1;
--x;
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits