Gracefully handle missing Google-specific transport parameters when using TLS This CL also adds a few DCHECKs that helped find this issue. gfe-relnote: specific to QUIC versions that use TLS which are disabled by flag quic_supports_tls_handshake PiperOrigin-RevId: 241826266 Change-Id: I4baa70e8f02deafa7148a94df45f96852913de7e
diff --git a/quic/core/quic_config.cc b/quic/core/quic_config.cc index be197de..25b549c 100644 --- a/quic/core/quic_config.cc +++ b/quic/core/quic_config.cc
@@ -783,26 +783,29 @@ QuicErrorCode error = idle_network_timeout_seconds_.ReceiveValue( params.idle_timeout, hello_type, error_details); if (error != QUIC_NO_ERROR) { + DCHECK(!error_details->empty()); return error; } const CryptoHandshakeMessage* peer_params = params.google_quic_params.get(); - if (!peer_params) { - return QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND; - } - error = - silent_close_.ProcessPeerHello(*peer_params, hello_type, error_details); - if (error != QUIC_NO_ERROR) { - return error; - } - error = initial_round_trip_time_us_.ProcessPeerHello(*peer_params, hello_type, - error_details); - if (error != QUIC_NO_ERROR) { - return error; - } - error = connection_options_.ProcessPeerHello(*peer_params, hello_type, - error_details); - if (error != QUIC_NO_ERROR) { - return error; + if (peer_params != nullptr) { + error = + silent_close_.ProcessPeerHello(*peer_params, hello_type, error_details); + if (error != QUIC_NO_ERROR) { + DCHECK(!error_details->empty()); + return error; + } + error = initial_round_trip_time_us_.ProcessPeerHello( + *peer_params, hello_type, error_details); + if (error != QUIC_NO_ERROR) { + DCHECK(!error_details->empty()); + return error; + } + error = connection_options_.ProcessPeerHello(*peer_params, hello_type, + error_details); + if (error != QUIC_NO_ERROR) { + DCHECK(!error_details->empty()); + return error; + } } initial_stream_flow_control_window_bytes_.SetReceivedValue(
diff --git a/quic/core/tls_client_handshaker.cc b/quic/core/tls_client_handshaker.cc index a5116ee..adc2c81 100644 --- a/quic/core/tls_client_handshaker.cc +++ b/quic/core/tls_client_handshaker.cc
@@ -140,6 +140,7 @@ error_details) != QUIC_NO_ERROR || session()->config()->ProcessTransportParameters( params, SERVER, error_details) != QUIC_NO_ERROR) { + DCHECK(!error_details->empty()); return false; } @@ -231,6 +232,7 @@ void TlsClientHandshaker::CloseConnection(QuicErrorCode error, const std::string& reason_phrase) { + DCHECK(!reason_phrase.empty()); state_ = STATE_CONNECTION_CLOSED; stream()->CloseConnectionWithDetails(error, reason_phrase); } @@ -241,6 +243,7 @@ std::string error_details; if (!ProcessTransportParameters(&error_details)) { + DCHECK(!error_details.empty()); CloseConnection(QUIC_HANDSHAKE_FAILED, error_details); return; }