Skip to content

Commit a8cd0c1

Browse files
ahmadsherifmehrdada
authored andcommitted
Avoid int32 overflow when applying initial window size setting
1 parent 8431165 commit a8cd0c1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

transport/http2_client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1166,7 +1166,7 @@ func (t *http2Client) applySettings(ss []http2.Setting) {
11661166
t.mu.Lock()
11671167
for _, stream := range t.activeStreams {
11681168
// Adjust the sending quota for each stream.
1169-
stream.sendQuotaPool.add(int(s.Val - t.streamSendQuota))
1169+
stream.sendQuotaPool.add(int(s.Val) - int(t.streamSendQuota))
11701170
}
11711171
t.streamSendQuota = s.Val
11721172
t.mu.Unlock()

transport/http2_server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ func (t *http2Server) applySettings(ss []http2.Setting) {
875875
t.mu.Lock()
876876
defer t.mu.Unlock()
877877
for _, stream := range t.activeStreams {
878-
stream.sendQuotaPool.add(int(s.Val - t.streamSendQuota))
878+
stream.sendQuotaPool.add(int(s.Val) - int(t.streamSendQuota))
879879
}
880880
t.streamSendQuota = s.Val
881881
}

0 commit comments

Comments
 (0)