diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-03-18 10:47:26 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-03-18 10:47:26 -0400 |
commit | 2aea6ca3260cee82a60168c047f4d0cc71f7c652 (patch) | |
tree | 4f45d5ed11b0f964712121dcd341edb0240d932a | |
parent | aaa33f144c4ad0db0c067df2f6703790be400acb (diff) | |
download | tor-2aea6ca3260cee82a60168c047f4d0cc71f7c652.tar.gz tor-2aea6ca3260cee82a60168c047f4d0cc71f7c652.zip |
Fix a ubsan warning in our ctypes replacements
ubsan doesn't like 1<<31, since that's an undefined integer
overflow. Instead, we should do 1u<<31.
-rw-r--r-- | src/common/compat.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/common/compat.h b/src/common/compat.h index 32effa5c74..30a33031ce 100644 --- a/src/common/compat.h +++ b/src/common/compat.h @@ -321,7 +321,7 @@ tor_memstr(const void *haystack, size_t hlen, const char *needle) extern const uint32_t TOR_##name##_TABLE[]; \ static INLINE int TOR_##name(char c) { \ uint8_t u = c; \ - return !!(TOR_##name##_TABLE[(u >> 5) & 7] & (1 << (u & 31))); \ + return !!(TOR_##name##_TABLE[(u >> 5) & 7] & (1u << (u & 31))); \ } DECLARE_CTYPE_FN(ISALPHA) DECLARE_CTYPE_FN(ISALNUM) |