From 4f875eb84567ccaa31cfc4e01ccd61acb43f9a58 Mon Sep 17 00:00:00 2001 From: John Naylor Date: Sun, 10 Dec 2023 21:27:13 +0700 Subject: [PATCH v9 3/6] 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 fbae7a5522..a167681c86 100644 --- a/src/include/common/hashfn_unstable.h +++ b/src/include/common/hashfn_unstable.h @@ -178,9 +178,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