summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYi Kong <yikong@google.com>2024-02-20 00:39:46 +0800
committerYi Kong <yikong@google.com>2024-02-20 00:39:46 +0800
commit93926f65a4abb5528d46c0fa32bc628b7a085c9c (patch)
tree9b29ee7888dd33aceba727a6654ff6ddc145850f
parent315a0f14a6cbfbb14036ddf9a38677e30e48656f (diff)
downloadnative-93926f65a4abb5528d46c0fa32bc628b7a085c9c.tar.gz
Turn off integer overflow UBSAN checks for hash functions
These functions intentionally overflows integers. The upcoming compiler update, clang-r522817, will start complaining about these overflows. Test: boot with new compiler Bug: 325934863 Change-Id: I5e83a55e880f4e78a7de5a7b01ee99e64f601ca7
-rw-r--r--libs/ui/DisplayIdentification.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/libs/ui/DisplayIdentification.cpp b/libs/ui/DisplayIdentification.cpp
index a45ffe1a19..82e5427317 100644
--- a/libs/ui/DisplayIdentification.cpp
+++ b/libs/ui/DisplayIdentification.cpp
@@ -47,6 +47,7 @@ uint64_t shiftMix(uint64_t val) {
return val ^ (val >> 47);
}
+__attribute__((no_sanitize("unsigned-integer-overflow")))
uint64_t hash64Len16(uint64_t u, uint64_t v) {
constexpr uint64_t kMul = 0x9ddfea08eb382d69;
uint64_t a = (u ^ v) * kMul;
@@ -57,6 +58,7 @@ uint64_t hash64Len16(uint64_t u, uint64_t v) {
return b;
}
+__attribute__((no_sanitize("unsigned-integer-overflow")))
uint64_t hash64Len0To16(const char* s, uint64_t len) {
constexpr uint64_t k2 = 0x9ae16a3b2f90404f;
constexpr uint64_t k3 = 0xc949d7c7509e6557;
@@ -401,4 +403,4 @@ uint64_t cityHash64Len0To16(std::string_view sv) {
return hash64Len0To16(sv.data(), len);
}
-} // namespace android \ No newline at end of file
+} // namespace android