summaryrefslogtreecommitdiff
path: root/vendor/google.golang.org/grpc/internal/transport/http_util.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/google.golang.org/grpc/internal/transport/http_util.go')
-rw-r--r--vendor/google.golang.org/grpc/internal/transport/http_util.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/vendor/google.golang.org/grpc/internal/transport/http_util.go b/vendor/google.golang.org/grpc/internal/transport/http_util.go
index f997f9fdb..607d2c4ce 100644
--- a/vendor/google.golang.org/grpc/internal/transport/http_util.go
+++ b/vendor/google.golang.org/grpc/internal/transport/http_util.go
@@ -196,11 +196,14 @@ func decodeTimeout(s string) (time.Duration, error) {
if !ok {
return 0, fmt.Errorf("transport: timeout unit is not recognized: %q", s)
}
- t, err := strconv.ParseInt(s[:size-1], 10, 64)
+ t, err := strconv.ParseUint(s[:size-1], 10, 64)
if err != nil {
return 0, err
}
- const maxHours = math.MaxInt64 / int64(time.Hour)
+ if t == 0 {
+ return 0, fmt.Errorf("transport: timeout must be positive: %q", s)
+ }
+ const maxHours = math.MaxInt64 / uint64(time.Hour)
if d == time.Hour && t > maxHours {
// This timeout would overflow math.MaxInt64; clamp it.
return time.Duration(math.MaxInt64), nil