diff --git a/atp/protocol_test.go b/atp/protocol_test.go index e5a24d6..fa124d2 100644 --- a/atp/protocol_test.go +++ b/atp/protocol_test.go @@ -257,7 +257,6 @@ func testExecuteWithChannels(closeChannel bool, t *testing.T) { wg.Wait() } -//nolint:funlen func TestProtocol_Client_ATP_v1(t *testing.T) { // Client ReadSchema and Execute atp v1 happy path. // This is not a fragile test because the ATP v1 is not changing. It is the legacy supported version. @@ -741,7 +740,6 @@ func TestProtocol_Error_Server_WorkStart(t *testing.T) { time.Sleep(time.Millisecond * 2) } -//nolint:funlen func TestProtocol_Error_Client_WorkStart(t *testing.T) { // Induce error on client's (and server incidentally) // start work message by closing the client's cbor diff --git a/schema/any_test.go b/schema/any_test.go index 500d659..92e390b 100644 --- a/schema/any_test.go +++ b/schema/any_test.go @@ -216,7 +216,6 @@ func TestAnyValidateCompatibilityLists(t *testing.T) { })) } -//nolint:funlen func TestAnyValidateCompatibilityMaps(t *testing.T) { // Test custom maps with schemas and data s1 := schema.NewAnySchema() diff --git a/schema/bool.go b/schema/bool.go index cb5ede6..8ba3f60 100644 --- a/schema/bool.go +++ b/schema/bool.go @@ -43,10 +43,12 @@ func (b BoolSchema) Unserialize(data any) (any, error) { case int: return intConverter(int64(v)) case uint: + //nolint:gosec // Not a security problem. It's only checking for 0 or 1 values. return intConverter(int64(v)) case int64: return intConverter(v) case uint64: + //nolint:gosec // Not a security problem. It's only checking for 0 or 1 values. return intConverter(int64(v)) case int32: return intConverter(int64(v)) diff --git a/schema/int.go b/schema/int.go index 23974ab..e1530c1 100644 --- a/schema/int.go +++ b/schema/int.go @@ -170,6 +170,9 @@ func intInputMapper(data any, u *UnitsDefinition) (int64, error) { case int: return int64(v), nil case uint: + if v > math.MaxInt64 { + return 0, fmt.Errorf("number is too large for an int64: %d", v) + } return int64(v), nil case int32: return int64(v), nil diff --git a/schema/map_test.go b/schema/map_test.go index 18e64f2..9165fd5 100644 --- a/schema/map_test.go +++ b/schema/map_test.go @@ -202,7 +202,6 @@ func TestMapSchemaTypesValidation(t *testing.T) { }() } -//nolint:funlen func TestMapSchemaCompatibilityValidation(t *testing.T) { s1 := schema.NewMapSchema( schema.NewStringSchema(nil, nil, nil), @@ -273,7 +272,6 @@ func TestMapSchemaCompatibilityValidation(t *testing.T) { assert.Error(t, s1.ValidateCompatibility(schema.NewIntEnumSchema(map[int64]*schema.DisplayValue{}, nil))) } -//nolint:funlen func TestMapCompatibilityValidation(t *testing.T) { s1 := schema.NewMapSchema( schema.NewStringSchema(nil, nil, nil),