Skip to content

Handle missing interim header callbacks and enforce stream limits#145

Open
kedar49 wants to merge 2 commits into
google:mainfrom
kedar49:issue-140
Open

Handle missing interim header callbacks and enforce stream limits#145
kedar49 wants to merge 2 commits into
google:mainfrom
kedar49:issue-140

Conversation

@kedar49

@kedar49 kedar49 commented Jun 7, 2026

Copy link
Copy Markdown

Summary

RFC 9000 requires that receiving a max_streams transport parameter (initial_max_streams_bidi or initial_max_streams_uni) with a value greater than $2^{60}$ must trigger a connection close with TRANSPORT_PARAMETER_ERROR. Previously, quiche parsed these as generic varint62 parameters (allowing values up to $2^{62}-1$), clamping them to uint32_t::max() inside QuicConfig without rejecting the invalid connection setup.

This change enforces a maximum parameter limit of $2^{60}$ on stream limits during initialization. Any parsed value exceeding $2^{60}$ fails parameter validation and closes the handshake connection with TRANSPORT_PARAMETER_ERROR.


Changes

quiche/quic/core/crypto/transport_parameters.cc

  • Defined kMaxInitialMaxStreamsLimit = 1ULL << 60.
  • Updated TransportParameters constructor to constrain initial_max_streams_bidi and initial_max_streams_uni parameters to a maximum limit of kMaxInitialMaxStreamsLimit.

quiche/quic/core/tls_client_handshaker.cc

  • Modified PrepareZeroRttConfig and FinishHandshake to explicitly close the connection with TRANSPORT_PARAMETER_ERROR instead of QUIC_HANDSHAKE_FAILED when transport parameters processing/parsing fails.

quiche/quic/core/tls_server_handshaker.cc

  • Modified EarlySelectCertCallback to close the connection with TRANSPORT_PARAMETER_ERROR when parsing client transport parameters fails.

quiche/quic/core/crypto/transport_parameters_test.cc

  • Added new test cases verifying $2^{60}$ parameter boundaries and rejection:
    • InvalidMaxStreamsBidiOrUni
    • ParseClientParamsFailsWithInvalidInitialMaxStreamsBidi
    • ParseClientParamsFailsWithInvalidInitialMaxStreamsUni

Testing

Run the following Bazel test command:

CC=gcc bazel test //quiche:quiche_tests --test_filter=*TransportParametersTest*

New tests added:

  • TransportParametersTest.InvalidMaxStreamsBidiOrUni
  • TransportParametersTest.ParseClientParamsFailsWithInvalidInitialMaxStreamsBidi
  • TransportParametersTest.ParseClientParamsFailsWithInvalidInitialMaxStreamsUni

Closes #140

kedar49 added 2 commits May 29, 2026 12:19
Interim 1xx responses can arrive even when the simple client has not
registered a handler yet. Guarding the session callback keeps those
responses from crashing the client while preserving late callback
registration for existing streams.

Fixes google#103
@kedar49

kedar49 commented Jun 10, 2026

Copy link
Copy Markdown
Author

@martinduke can you please review this ?

@martinduke martinduke self-assigned this Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

initial_max_streams above 2^60 Is Clamped Instead of Rejected

2 participants