gcs: fix constant overflow for 32-bit systems

This commit is contained in:
Olaoluwa Osuntokun 2017-08-24 14:18:27 -07:00
parent 18097a52c4
commit e14ee486e6

View file

@ -9,6 +9,7 @@ import (
"encoding/binary" "encoding/binary"
"fmt" "fmt"
"io" "io"
"math"
"sort" "sort"
"github.com/aead/siphash" "github.com/aead/siphash"
@ -60,7 +61,7 @@ func BuildGCSFilter(P uint8, key [KeySize]byte, data [][]byte) (*Filter, error)
if len(data) == 0 { if len(data) == 0 {
return nil, ErrNoData return nil, ErrNoData
} }
if len(data) > ((1 << 32) - 1) { if len(data) > math.MaxInt32 {
return nil, ErrNTooBig return nil, ErrNTooBig
} }
if P > 32 { if P > 32 {