v8-0005-Fix-alignment-issue-in-the-original-fastash.patch
text/x-patch
Filename: v8-0005-Fix-alignment-issue-in-the-original-fastash.patch
Type: text/x-patch
Part: 3
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v8-0005
Subject: Fix alignment issue in the original fastash
| File | + | − |
|---|---|---|
| src/include/common/hashfn_unstable.h | 2 | 1 |
From 2f452e621a07433a4f539614d7b7c09eef29b1e8 Mon Sep 17 00:00:00 2001
From: John Naylor <john.naylor@postgresql.org>
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