Add connection ID length checks

These changes only impact behavior for versions that support variable length connection IDs, and all of those versions are disabled by flags, so we don't need extra flag protection.

gfe-relnote: add connection ID length checks, protected by disabled quic_enable_v47 flag
PiperOrigin-RevId: 261237221
Change-Id: I89e7bec58644b7ec18e3c7ce3ecbd6d93c9c0fc3
diff --git a/quic/core/quic_connection_id.cc b/quic/core/quic_connection_id.cc
index 3ad13a3..7d0f8d7 100644
--- a/quic/core/quic_connection_id.cc
+++ b/quic/core/quic_connection_id.cc
@@ -57,7 +57,8 @@
       kQuicMaxConnectionIdLength <= std::numeric_limits<uint8_t>::max(),
       "kQuicMaxConnectionIdLength too high");
   if (length > kQuicMaxConnectionIdLength) {
-    QUIC_BUG << "Attempted to create connection ID of length " << length;
+    QUIC_BUG << "Attempted to create connection ID of length "
+             << static_cast<int>(length);
     length = kQuicMaxConnectionIdLength;
   }
   length_ = length;
@@ -126,7 +127,8 @@
 
 void QuicConnectionId::set_length(uint8_t length) {
   if (length > kQuicMaxConnectionIdLength) {
-    QUIC_BUG << "Attempted to set connection ID length to " << length;
+    QUIC_BUG << "Attempted to set connection ID length to "
+             << static_cast<int>(length);
     length = kQuicMaxConnectionIdLength;
   }
   if (GetQuicRestartFlag(quic_use_allocated_connection_ids)) {