From 2f452e621a07433a4f539614d7b7c09eef29b1e8 Mon Sep 17 00:00:00 2001 From: John Naylor Date: Sun, 10 Dec 2023 21:27:13 +0700 Subject: [PATCH v8 5/5] Fix alignment issue in the original fastash Found by UBSan in CI --- src/include/common/hashfn_unstable.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/include/common/hashfn_unstable.h b/src/include/common/hashfn_unstable.h index 13d6d70910..a13d577965 100644 --- a/src/include/common/hashfn_unstable.h +++ b/src/include/common/hashfn_unstable.h @@ -211,9 +211,10 @@ uint64_t fasthash64_orig(const void *buf, size_t len, uint64_t seed) uint64_t v; while (pos != end) { - v = *pos++; + memcpy(&v, pos, 8); h ^= mix(v); h *= m; + pos++; } pos2 = (const unsigned char*)pos; -- 2.43.0