Skip to content

Commit

Permalink
RFC 9000 s. 19.8: Enforce maximum stream size
Browse files Browse the repository at this point in the history
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from #21135)
  • Loading branch information
hlandau authored and paulidale committed Jul 16, 2023
1 parent 212616e commit 283938f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ssl/quic/quic_rx_depack.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,21 @@ static int depack_do_frame_stream(PACKET *pkt, QUIC_CHANNEL *ch,
return 0;
}

/*
* RFC 9000 s. 19.8: "The largest offset delivered on a stream -- the sum of
* the offset and data length -- cannot exceed 2**62 - 1, as it is not
* possible to provide flow control credit for that data. Receipt of a frame
* that exceeds this limit MUST be treated as a connection error of type
* FRAME_ENCODING_ERROR or FLOW_CONTROL_ERROR."
*/
if (frame_data.offset + frame_data.len > (((uint64_t)1) << 62) - 1) {
ossl_quic_channel_raise_protocol_error(ch,
QUIC_ERR_FRAME_ENCODING_ERROR,
frame_type,
"oversize stream");
return 0;
}

switch (stream->recv_state) {
case QUIC_RSTREAM_STATE_RECV:
case QUIC_RSTREAM_STATE_SIZE_KNOWN:
Expand Down

0 comments on commit 283938f

Please sign in to comment.