Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

rc: fix large numeric parameters being rejected on 32 bit builds

Jeremy Schoemakerb5f83bdbf29a
diff --git a/fs/rc/params.go b/fs/rc/params.go
index e3f37b18f..402be3c7b 100644
--- a/fs/rc/params.go
+++ b/fs/rc/params.go
@@ -173,7 +173,7 @@ func (p Params) GetInt64(key string) (int64, error) {
}
return int64(x), nil
case string:
- i, err := strconv.ParseInt(x, 10, 0)
+ i, err := strconv.ParseInt(x, 10, 64)
if err != nil {
return 0, ErrParamInvalid{fmt.Errorf("couldn't parse key %q (%v) as int64: %w", key, value, err)}
}
diff --git a/fs/rc/params_test.go b/fs/rc/params_test.go
index b1afc44e3..6714a5a3f 100644
--- a/fs/rc/params_test.go
+++ b/fs/rc/params_test.go
@@ -124,6 +124,10 @@ func TestParamsGetInt64(t *testing.T) {
{float64(math.MaxInt64), 0, "overflows int64"},
{math.Nextafter(float64(math.MaxInt64), 0), 9223372036854774784, ""},
{float64(math.MinInt64), math.MinInt64, ""},
+ {"3000000000", 3000000000, ""},
+ {"9223372036854775807", math.MaxInt64, ""},
+ {"-9223372036854775808", math.MinInt64, ""},
+ {"9223372036854775808", 0, "couldn't parse"},
} {
t.Run(fmt.Sprintf("%T=%v", test.value, test.value), func(t *testing.T) {
in := Params{