From a8cd0c13a447ed2fdbad93a9afbf7f4302d386ab Mon Sep 17 00:00:00 2001 From: Ahmad Sherif Date: Wed, 31 May 2017 15:55:17 +0200 Subject: [PATCH] Avoid int32 overflow when applying initial window size setting --- transport/http2_client.go | 2 +- transport/http2_server.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/transport/http2_client.go b/transport/http2_client.go index d27199b2211a..27a72a0e5566 100644 --- a/transport/http2_client.go +++ b/transport/http2_client.go @@ -1166,7 +1166,7 @@ func (t *http2Client) applySettings(ss []http2.Setting) { t.mu.Lock() for _, stream := range t.activeStreams { // Adjust the sending quota for each stream. - stream.sendQuotaPool.add(int(s.Val - t.streamSendQuota)) + stream.sendQuotaPool.add(int(s.Val) - int(t.streamSendQuota)) } t.streamSendQuota = s.Val t.mu.Unlock() diff --git a/transport/http2_server.go b/transport/http2_server.go index 130a39d52be2..85590d2086c8 100644 --- a/transport/http2_server.go +++ b/transport/http2_server.go @@ -875,7 +875,7 @@ func (t *http2Server) applySettings(ss []http2.Setting) { t.mu.Lock() defer t.mu.Unlock() for _, stream := range t.activeStreams { - stream.sendQuotaPool.add(int(s.Val - t.streamSendQuota)) + stream.sendQuotaPool.add(int(s.Val) - int(t.streamSendQuota)) } t.streamSendQuota = s.Val }