gfe-relnote: Close the connection if a STOP_WAITING frame is received in v44 or above.  Protected by gfe2_reloadable_flag_quic_do_not_accept_stop_waiting.

PiperOrigin-RevId: 246399630
Change-Id: I9a810abb4d409f114f3e565ae6c5a37551073f6c
diff --git a/quic/core/quic_framer.cc b/quic/core/quic_framer.cc
index 67d32e3..3553628 100644
--- a/quic/core/quic_framer.cc
+++ b/quic/core/quic_framer.cc
@@ -21,6 +21,7 @@
 #include "net/third_party/quiche/src/quic/core/quic_constants.h"
 #include "net/third_party/quiche/src/quic/core/quic_data_reader.h"
 #include "net/third_party/quiche/src/quic/core/quic_data_writer.h"
+#include "net/third_party/quiche/src/quic/core/quic_error_codes.h"
 #include "net/third_party/quiche/src/quic/core/quic_socket_address_coder.h"
 #include "net/third_party/quiche/src/quic/core/quic_stream_frame_data_producer.h"
 #include "net/third_party/quiche/src/quic/core/quic_types.h"
@@ -2731,6 +2732,12 @@
       }
 
       case STOP_WAITING_FRAME: {
+        if (GetQuicReloadableFlag(quic_do_not_accept_stop_waiting) &&
+            version_.transport_version >= QUIC_VERSION_44) {
+          QUIC_RELOADABLE_FLAG_COUNT(quic_do_not_accept_stop_waiting);
+          set_detailed_error("STOP WAITING not supported in version 44+.");
+          return RaiseError(QUIC_INVALID_STOP_WAITING_DATA);
+        }
         QuicStopWaitingFrame stop_waiting_frame;
         if (!ProcessStopWaitingFrame(reader, header, &stop_waiting_frame)) {
           return RaiseError(QUIC_INVALID_STOP_WAITING_DATA);
diff --git a/quic/core/quic_framer_test.cc b/quic/core/quic_framer_test.cc
index a717168..3c0b66d 100644
--- a/quic/core/quic_framer_test.cc
+++ b/quic/core/quic_framer_test.cc
@@ -4097,6 +4097,15 @@
 
   std::unique_ptr<QuicEncryptedPacket> encrypted(
       AssemblePacketFromFragments(fragments));
+  if (GetQuicReloadableFlag(quic_do_not_accept_stop_waiting) &&
+      version_.transport_version >= QUIC_VERSION_44) {
+    EXPECT_FALSE(framer_.ProcessPacket(*encrypted));
+    EXPECT_EQ(QUIC_INVALID_STOP_WAITING_DATA, framer_.error());
+    EXPECT_EQ("STOP WAITING not supported in version 44+.",
+              framer_.detailed_error());
+    return;
+  }
+
   EXPECT_TRUE(framer_.ProcessPacket(*encrypted));
 
   EXPECT_EQ(QUIC_NO_ERROR, framer_.error());
@@ -4114,7 +4123,9 @@
 }
 
 TEST_P(QuicFramerTest, InvalidNewStopWaitingFrame) {
-  if (version_.transport_version == QUIC_VERSION_99) {
+  if (version_.transport_version == QUIC_VERSION_99 ||
+      (GetQuicReloadableFlag(quic_do_not_accept_stop_waiting) &&
+       version_.transport_version >= QUIC_VERSION_44)) {
     return;
   }
   SetDecrypterLevel(ENCRYPTION_FORWARD_SECURE);