From 996b879bb8287afa0ba2c3d11d69225d2525a2dd Mon Sep 17 00:00:00 2001 From: Tianyi Wang Date: Wed, 15 Feb 2023 21:40:57 +0000 Subject: [PATCH 1/3] fix uint testing data overflow bug --- aws/retry/jitter_backoff_test.go | 2 +- .../internal/benchmark/dynamodb/customizations_test.go | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/aws/retry/jitter_backoff_test.go b/aws/retry/jitter_backoff_test.go index 10951b32840..605312db6cb 100644 --- a/aws/retry/jitter_backoff_test.go +++ b/aws/retry/jitter_backoff_test.go @@ -38,7 +38,7 @@ func TestExponentialJitterBackoff_AttemptDelay(t *testing.T) { "max delay": { MaxBackoff: 20 * time.Second, RandFloat: func() (float64, error) { return maxB, nil }, - Attempt: 1 << 53, + Attempt: math.MaxInt, Expect: timeconv.FloatSecondsDur(maxB * math.Exp2(math.Log2(20))), }, } diff --git a/service/internal/benchmark/dynamodb/customizations_test.go b/service/internal/benchmark/dynamodb/customizations_test.go index 8ec0799ce2a..ff4905632cd 100644 --- a/service/internal/benchmark/dynamodb/customizations_test.go +++ b/service/internal/benchmark/dynamodb/customizations_test.go @@ -25,8 +25,8 @@ import ( type testData struct { filename string - respChecksum int - respGzipChecksum int + respChecksum int64 + respGzipChecksum int64 } func BenchmarkCustomizations(b *testing.B) { @@ -71,7 +71,7 @@ func benchCustomizationsOld(b *testing.B, c testData) { r.HTTPResponse = &http.Response{ StatusCode: 200, Header: http.Header{ - "X-Amz-Crc32": []string{strconv.Itoa(c.respChecksum)}, + "X-Amz-Crc32": []string{strconv.FormatInt(c.respChecksum, 10)}, }, ContentLength: int64(len(body)), Body: ioutil.NopCloser(bytes.NewReader(body)), @@ -127,7 +127,7 @@ func benchCustomizationsSmithy(b *testing.B, c testData) { Region: "us-west-2", Credentials: unit.StubCredentialsProvider{}, HTTPClient: &mockClient{ - ChecksumHeaderValue: []string{strconv.Itoa(c.respChecksum)}, + ChecksumHeaderValue: []string{strconv.FormatInt(c.respChecksum, 10)}, ScanRespBody: body, }, } @@ -141,7 +141,7 @@ func benchCustomizationsSmithy(b *testing.B, c testData) { b.Run("all enabled", func(b *testing.B) { client := dynamodb.New(options, func(o *dynamodb.Options) { o.HTTPClient = &mockClient{ - ChecksumHeaderValue: []string{strconv.Itoa(c.respGzipChecksum)}, + ChecksumHeaderValue: []string{strconv.FormatInt(c.respGzipChecksum, 10)}, ScanRespGzipBody: gzipBody, } o.DisableValidateResponseChecksum = false From b19c337948f9867adb6295106bc13474c9ad6f6f Mon Sep 17 00:00:00 2001 From: Tianyi Wang Date: Fri, 17 Feb 2023 21:07:16 +0000 Subject: [PATCH 2/3] fix int overflow on 32 bit architecture --- aws/retry/jitter_backoff_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws/retry/jitter_backoff_test.go b/aws/retry/jitter_backoff_test.go index 605312db6cb..f040be0f16e 100644 --- a/aws/retry/jitter_backoff_test.go +++ b/aws/retry/jitter_backoff_test.go @@ -38,7 +38,7 @@ func TestExponentialJitterBackoff_AttemptDelay(t *testing.T) { "max delay": { MaxBackoff: 20 * time.Second, RandFloat: func() (float64, error) { return maxB, nil }, - Attempt: math.MaxInt, + Attempt: 2147483647, Expect: timeconv.FloatSecondsDur(maxB * math.Exp2(math.Log2(20))), }, } From 1ca1e1831b92e691f1c1d35204f914740ed1345e Mon Sep 17 00:00:00 2001 From: Tianyi Wang Date: Fri, 17 Feb 2023 21:39:14 +0000 Subject: [PATCH 3/3] add changelog entry --- .changelog/f4bce07753bc4db9a6e8bf18d0b8ce8b.json | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .changelog/f4bce07753bc4db9a6e8bf18d0b8ce8b.json diff --git a/.changelog/f4bce07753bc4db9a6e8bf18d0b8ce8b.json b/.changelog/f4bce07753bc4db9a6e8bf18d0b8ce8b.json new file mode 100644 index 00000000000..5cd36656bb9 --- /dev/null +++ b/.changelog/f4bce07753bc4db9a6e8bf18d0b8ce8b.json @@ -0,0 +1,9 @@ +{ + "id": "f4bce077-53bc-4db9-a6e8-bf18d0b8ce8b", + "type": "bugfix", + "description": "fix int overflow bug on 32 bit architecture", + "modules": [ + ".", + "service/internal/benchmark" + ] +} \ No newline at end of file