From 7f7717ba46dc4fcface7abbfddc3eafe7914e803 Mon Sep 17 00:00:00 2001 From: Benjamin Saunders Date: Fri, 22 May 2020 14:32:48 -0700 Subject: [PATCH] Correct errors on illegal stream limits --- quinn-proto/src/connection/mod.rs | 5 +++++ quinn-proto/src/connection/streams.rs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/quinn-proto/src/connection/mod.rs b/quinn-proto/src/connection/mod.rs index 3585f2a74..85d614eab 100644 --- a/quinn-proto/src/connection/mod.rs +++ b/quinn-proto/src/connection/mod.rs @@ -2136,6 +2136,11 @@ where ); } Frame::StreamsBlocked { dir, limit } => { + if limit > MAX_STREAM_COUNT { + return Err(TransportError::FRAME_ENCODING_ERROR( + "unrepresentable stream limit", + )); + } debug!( "peer claims to be blocked opening more than {} {} streams", limit, dir diff --git a/quinn-proto/src/connection/streams.rs b/quinn-proto/src/connection/streams.rs index 95075961d..a1e9ce9c6 100644 --- a/quinn-proto/src/connection/streams.rs +++ b/quinn-proto/src/connection/streams.rs @@ -642,7 +642,7 @@ impl Streams { pub fn received_max_streams(&mut self, dir: Dir, count: u64) -> Result<(), TransportError> { if count > MAX_STREAM_COUNT { - return Err(TransportError::STREAM_LIMIT_ERROR( + return Err(TransportError::FRAME_ENCODING_ERROR( "unrepresentable stream limit", )); }