From e14ee486e671262d852b560cacf44ad4359d87a4 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Thu, 24 Aug 2017 14:18:27 -0700 Subject: [PATCH] gcs: fix constant overflow for 32-bit systems --- gcs/gcs.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcs/gcs.go b/gcs/gcs.go index b186bec..2e32dcd 100644 --- a/gcs/gcs.go +++ b/gcs/gcs.go @@ -9,6 +9,7 @@ import ( "encoding/binary" "fmt" "io" + "math" "sort" "github.com/aead/siphash" @@ -60,7 +61,7 @@ func BuildGCSFilter(P uint8, key [KeySize]byte, data [][]byte) (*Filter, error) if len(data) == 0 { return nil, ErrNoData } - if len(data) > ((1 << 32) - 1) { + if len(data) > math.MaxInt32 { return nil, ErrNTooBig } if P > 32 {