mirror of
https://github.com/apple/swift-nio-http2
synced 2026-11-28 05:14:25 +00:00
Resolve off-by-one errors in settings bounds. (#97)
Motivation: When we're validating that settings are in their bounds, we should probably endeavour to express those bounds correctly. Modifications: - Fixed the bounds checks on SETTINGS_INITIAL_WINDOW_SIZE and SETTINGS_MAX_FRAME_SIZE. - Added regression tests. Result: Better correctness.
This commit is contained in:
1 parent
ae57c2a0d8
commit
08db9d8cd4
3 files changed
+24
-2
No files matched your search
@@ -1304,11 +1304,11 @@ extension HTTP2ConnectionStateMachine {
|
||||
return .connectionError(underlyingError: NIOHTTP2Errors.InvalidSetting(setting: setting), type: .protocolError)
|
||||
}
|
||||
case .initialWindowSize:
|
||||
guard setting._value < HTTP2FlowControlWindow.maxSize else {
|
||||
guard setting._value <= HTTP2FlowControlWindow.maxSize else {
|
||||
return .connectionError(underlyingError: NIOHTTP2Errors.InvalidSetting(setting: setting), type: .flowControlError)
|
||||
}
|
||||
case .maxFrameSize:
|
||||
guard setting._value >= (1 << 14) && setting._value < ((1 << 24) - 1) else {
|
||||
guard setting._value >= (1 << 14) && setting._value <= ((1 << 24) - 1) else {
|
||||
return .connectionError(underlyingError: NIOHTTP2Errors.InvalidSetting(setting: setting), type: .protocolError)
|
||||
}
|
||||
default:
|
||||
|
||||
Reference in new issue
Block a user