Skip to content

Commit 81cc182

Browse files
authored
Update clampedToValidWindowSize to use Int32.max (#546)
Fixes a runtime crash on 32-bit devices because of an overflow. This occurred immediately when trying to make a HTTP2 request on our Android 32-bit devices.
1 parent 335e5b5 commit 81cc182

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/NIOHTTP2/HTTP2ChannelHandler.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,8 +1653,8 @@ extension NIOHTTP2Handler {
16531653
}
16541654

16551655
extension Int {
1656-
/// Clamps a target window size to the range `0 ... (1 << 31 - 1)` valid for HTTP/2 flow control.
1656+
/// Clamps a target window size to the range `0 ... Int32.max` valid for HTTP/2 flow control.
16571657
internal var clampedToValidWindowSize: Int {
1658-
Swift.max(0, Swift.min(self, (1 << 31) - 1))
1658+
Swift.max(0, Swift.min(self, Int(Int32.max)))
16591659
}
16601660
}

0 commit comments

Comments
 (0)