Match against math.MaxInt32 in the Go code. When building for 32-bit, len() in Go returns a (signed) 32-bit value. This was exceeding the constant (2^32) and causing a build failure. Change-Id: I3b0c08792b0fea0be8d571ebd7ebc1714f9a86a2
diff --git a/go/protocol/protocol.go b/go/protocol/protocol.go index ba33dde..ad8f7dd 100644 --- a/go/protocol/protocol.go +++ b/go/protocol/protocol.go
@@ -21,6 +21,7 @@ "encoding/binary" "errors" "io" + "math" "sort" "golang.org/x/crypto/ed25519" @@ -82,7 +83,7 @@ return make([]byte, 4), nil } - if len(msg) >= 1<<32 { + if len(msg) >= math.MaxInt32 { return nil, errors.New("encode: too many tags") } @@ -156,7 +157,7 @@ tags := bytes[4*(1+numTags-1):] payloads := bytes[4*(1+(numTags-1)+numTags):] - if len(payloads) > 1<<32 { + if len(payloads) > math.MaxInt32 { return nil, errors.New("decode: message too large") } payloadLength := uint32(len(payloads))