Add QUIC_BUG_IF to QuicUtils::GetCryptoStreamId
In QUIC versions that use CRYPTO frames (instead of stream 1 frames) for
the crypto handshake, the concept of a "crypto stream ID" makes no
sense, so QuicUtils::GetCryptoStreamId should hit a QUIC_BUG_IF to
prevent its misuse.
gfe-relnote: Add QUIC_BUG_IF protected behind QuicVersionUsesCryptoFrames
PiperOrigin-RevId: 248463613
Change-Id: If6768658e9ffc058778b53a91f95839826602fbf
diff --git a/quic/core/chlo_extractor.cc b/quic/core/chlo_extractor.cc
index 2398693..ec3a899 100644
--- a/quic/core/chlo_extractor.cc
+++ b/quic/core/chlo_extractor.cc
@@ -151,8 +151,8 @@
return false;
}
QuicStringPiece data(frame.data_buffer, frame.data_length);
- if (frame.stream_id ==
- QuicUtils::GetCryptoStreamId(framer_->transport_version()) &&
+ if (QuicUtils::IsCryptoStreamId(framer_->transport_version(),
+ frame.stream_id) &&
frame.offset == 0 && QuicTextUtils::StartsWith(data, "CHLO")) {
return OnHandshakeData(data);
}