Copy cached transport parameters and application states instead of using pointers in QUIC 0-RTT setup.

There is currently a time gap between looking up the cache and using the cache. During this gap, the cache could be invalidated.

Client side change. not protected.

PiperOrigin-RevId: 327337399
Change-Id: I04bc99d8cf77b613f635e1da91d75c8269cf9e95
diff --git a/quic/core/tls_client_handshaker.cc b/quic/core/tls_client_handshaker.cc
index 265496d..dfaab51 100644
--- a/quic/core/tls_client_handshaker.cc
+++ b/quic/core/tls_client_handshaker.cc
@@ -130,7 +130,8 @@
 bool TlsClientHandshaker::PrepareZeroRttConfig(
     QuicResumptionState* cached_state) {
   std::string error_details;
-  if (handshaker_delegate()->ProcessTransportParameters(
+  if (!cached_state->transport_params ||
+      handshaker_delegate()->ProcessTransportParameters(
           *(cached_state->transport_params),
           /*is_resumption = */ true, &error_details) != QUIC_NO_ERROR) {
     QUIC_BUG << "Unable to parse cached transport parameters.";
@@ -144,7 +145,9 @@
   session()->OnConfigNegotiated();
 
   if (has_application_state_) {
-    if (!session()->ResumeApplicationState(cached_state->application_state)) {
+    if (!cached_state->application_state ||
+        !session()->ResumeApplicationState(
+            cached_state->application_state.get())) {
       QUIC_BUG << "Unable to parse cached application state.";
       CloseConnection(QUIC_HANDSHAKE_FAILED,
                       "Client failed to parse cached application state.");