File: 0004-fix-int-overflow-on-32-bit-platforms.patch

package info (click to toggle)
golang-github-aws-aws-sdk-go 1.21.6%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 104,556 kB
  • sloc: ruby: 193; makefile: 171; xml: 11
file content (35 lines) | stat: -rw-r--r-- 1,452 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Description: service/ec2: Fix int overflow in minTime on 386 and arm
Author: Anthony Fok <foka@debian.org>
Origin: vendor
Bug: https://github.com/aws/aws-sdk-go/issues/2786
Last-Update: 2019-08-26
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
diff --git a/service/ec2/customizations.go b/service/ec2/customizations.go
index 7b42719d..7c9fccd7 100644
--- a/service/ec2/customizations.go
+++ b/service/ec2/customizations.go
@@ -38,8 +38,8 @@ func customRetryRule(r *request.Request) time.Duration {
 		count = len(retryTimes) - 1
 	}
 
-	minTime := int(retryTimes[count])
-	return time.Duration(sdkrand.SeededRand.Intn(minTime) + minTime)
+	minTime := int64(retryTimes[count])
+	return time.Duration(sdkrand.SeededRand.Int63n(minTime) + minTime)
 }
 
 func setCustomRetryer(c *client.Client) {
diff --git a/service/ec2/retryer_test.go b/service/ec2/retryer_test.go
index 5c955a0d..2900d6d5 100644
--- a/service/ec2/retryer_test.go
+++ b/service/ec2/retryer_test.go
@@ -27,7 +27,7 @@ func TestCustomRetryer(t *testing.T) {
 	req.RetryCount = 15
 	duration = svc.Client.Retryer.RetryRules(req)
 	if duration < time.Second*5 || duration > time.Second*10 {
-		t.Errorf("expected duration to be between 1 and 2, but received %v", duration)
+		t.Errorf("expected duration to be between 5 and 10, but received %v", duration)
 	}
 
 	svc = New(unit.Session, &aws.Config{Region: aws.String("us-west-2"), Retryer: client.DefaultRetryer{}})