From aeeff960fcb0b10565e2636a7c8c2ff63c48bc2d Mon Sep 17 00:00:00 2001 From: Chris Hung Date: Wed, 25 Nov 2020 15:31:28 +0800 Subject: [PATCH] fix ToInt64E to cast value to int64 correctly on 32-bit system ToInt64E currently try cast the value to int type, which default to int32 type on 32-bit system and will result in potential overflow error. Fix this by update the bitSize to 64 to cast the value to int64 on any system. --- caste.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/caste.go b/caste.go index 9ac1015..905c71e 100644 --- a/caste.go +++ b/caste.go @@ -211,7 +211,7 @@ func ToInt64E(i interface{}) (int64, error) { case float32: return int64(s), nil case string: - v, err := strconv.ParseInt(s, 0, 0) + v, err := strconv.ParseInt(s, 0, 64) if err == nil { return v, nil }