Fix MoqtSessionTests with unitialized peer_role_.

This should never happen except in tests, because the SETUP always arrives to set the role. But this CL adds a default value, just in case future changes disrupt the checks around SETUP arriving first and containing Role.

Also fixed an old initialized value problem where the varint for the Role parameter isn't correctly formatted, but we don't exit.

PiperOrigin-RevId: 615050498
diff --git a/quiche/quic/moqt/moqt_parser.cc b/quiche/quic/moqt/moqt_parser.cc
index 0c18d0d..4821d69 100644
--- a/quiche/quic/moqt/moqt_parser.cc
+++ b/quiche/quic/moqt/moqt_parser.cc
@@ -281,7 +281,9 @@
           return 0;
         }
         uint64_t index;
-        StringViewToVarInt(value, index);
+        if (!StringViewToVarInt(value, index)) {
+          return 0;
+        }
         if (index > static_cast<uint64_t>(MoqtRole::kRoleMax)) {
           ParseError("Invalid ROLE parameter");
           return 0;
@@ -343,7 +345,9 @@
           return 0;
         }
         uint64_t index;
-        StringViewToVarInt(value, index);
+        if (!StringViewToVarInt(value, index)) {
+          return 0;
+        }
         if (index > static_cast<uint64_t>(MoqtRole::kRoleMax)) {
           ParseError("Invalid ROLE parameter");
           return 0;
diff --git a/quiche/quic/moqt/moqt_session.h b/quiche/quic/moqt/moqt_session.h
index 585a223..3ce6e2e 100644
--- a/quiche/quic/moqt/moqt_session.h
+++ b/quiche/quic/moqt/moqt_session.h
@@ -262,8 +262,10 @@
   absl::flat_hash_map<std::string, MoqtOutgoingAnnounceCallback>
       pending_outgoing_announces_;
 
-  // The role the peer advertised in its SETUP message.
-  MoqtRole peer_role_;
+  // The role the peer advertised in its SETUP message. Initialize it to avoid
+  // an uninitialized value if no SETUP arrives or it arrives with no Role
+  // parameter, and other checks have changed/been disabled.
+  MoqtRole peer_role_ = MoqtRole::kPubSub;
 };
 
 }  // namespace moqt