v9-0003-Fix-alignment-issue-in-the-original-fastash.patch
application/x-patch
Filename: v9-0003-Fix-alignment-issue-in-the-original-fastash.patch
Type: application/x-patch
Part: 5
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 v9-0003
Subject: Fix alignment issue in the original fastash
| File | + | − |
|---|---|---|
| src/include/common/hashfn_unstable.h | 2 | 1 |
From 4f875eb84567ccaa31cfc4e01ccd61acb43f9a58 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 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