aboutsummaryrefslogtreecommitdiff
path: root/src/bytes
diff options
context:
space:
mode:
authorKeith Randall <khr@google.com>2019-09-03 10:27:48 -0700
committerKeith Randall <khr@golang.org>2019-09-03 19:37:16 +0000
commit7c90e2cbda677a1a9993403df192f31fb011a112 (patch)
treed7a2efef3e60dab6c7cfe55a8594961805933f1e /src/bytes
parentd2f958d8d11bcf62fe572885133bfaef41307a14 (diff)
downloadgo-7c90e2cbda677a1a9993403df192f31fb011a112.tar.gz
go-7c90e2cbda677a1a9993403df192f31fb011a112.zip
bytes/hash: disable seed test on 32-bit platforms
The distribution of hash outputs when varying the seed is not good enough on 32-bit platforms. This isn't a likely attack vector (the adversary controlling the seed), so it isn't a huge deal. Would be nice to fix, though. For now, just skip this test. Fixes #33988 Change-Id: Icf51ab687fc215422a5492ae78e6f414b33e04cb Reviewed-on: https://go-review.googlesource.com/c/go/+/193078 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/bytes')
-rw-r--r--src/bytes/hash/smhasher_test.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/bytes/hash/smhasher_test.go b/src/bytes/hash/smhasher_test.go
index 1b7b44db09..f5169ffa27 100644
--- a/src/bytes/hash/smhasher_test.go
+++ b/src/bytes/hash/smhasher_test.go
@@ -12,6 +12,7 @@ import (
"runtime"
"strings"
"testing"
+ "unsafe"
)
// Smhasher is a torture test for hash functions.
@@ -450,6 +451,9 @@ func text(t *testing.T, prefix, suffix string) {
// Make sure different seed values generate different hashes.
func TestSmhasherSeed(t *testing.T) {
+ if unsafe.Sizeof(uintptr(0)) == 4 {
+ t.Skip("32-bit platforms don't have ideal seed-input distributions (see issue 33988)")
+ }
h := newHashSet()
const N = 100000
s := "hello"