| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/quic/core/quic_crypto_server_stream.h" | 5 #include "net/quic/core/quic_crypto_server_stream.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 INSTANTIATE_TEST_CASE_P(YetMoreTests, | 528 INSTANTIATE_TEST_CASE_P(YetMoreTests, |
| 529 QuicCryptoServerStreamTestWithFakeProofSource, | 529 QuicCryptoServerStreamTestWithFakeProofSource, |
| 530 testing::Bool()); | 530 testing::Bool()); |
| 531 | 531 |
| 532 // Regression test for b/35422225, in which multiple CHLOs arriving on the same | 532 // Regression test for b/35422225, in which multiple CHLOs arriving on the same |
| 533 // connection in close succession could cause a crash, especially when the use | 533 // connection in close succession could cause a crash, especially when the use |
| 534 // of Mentat signing meant that it took a while for each CHLO to be processed. | 534 // of Mentat signing meant that it took a while for each CHLO to be processed. |
| 535 TEST_P(QuicCryptoServerStreamTestWithFakeProofSource, MultipleChlo) { | 535 TEST_P(QuicCryptoServerStreamTestWithFakeProofSource, MultipleChlo) { |
| 536 Initialize(); | 536 Initialize(); |
| 537 GetFakeProofSource()->Activate(); | 537 GetFakeProofSource()->Activate(); |
| 538 base::SetFlag(&FLAGS_quic_reloadable_flag_fix_quic_callback_crash, true); | |
| 539 EXPECT_CALL(*server_session_->helper(), CanAcceptClientHello(_, _, _)) | 538 EXPECT_CALL(*server_session_->helper(), CanAcceptClientHello(_, _, _)) |
| 540 .WillOnce(testing::Return(true)); | 539 .WillOnce(testing::Return(true)); |
| 541 | 540 |
| 542 // Create a minimal CHLO | 541 // Create a minimal CHLO |
| 543 MockClock clock; | 542 MockClock clock; |
| 544 QuicVersion version = AllSupportedVersions().front(); | 543 QuicVersion version = AllSupportedVersions().front(); |
| 545 CryptoHandshakeMessage chlo = crypto_test_utils::GenerateDefaultInchoateCHLO( | 544 CryptoHandshakeMessage chlo = crypto_test_utils::GenerateDefaultInchoateCHLO( |
| 546 &clock, version, &server_crypto_config_); | 545 &clock, version, &server_crypto_config_); |
| 547 | 546 |
| 548 // Send in the CHLO, and check that a callback is now pending in the | 547 // Send in the CHLO, and check that a callback is now pending in the |
| 549 // ProofSource. | 548 // ProofSource. |
| 550 server_stream()->OnHandshakeMessage(chlo); | 549 server_stream()->OnHandshakeMessage(chlo); |
| 551 EXPECT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 1); | 550 EXPECT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 1); |
| 552 | 551 |
| 553 // Send in a second CHLO while processing of the first is still pending. | 552 // Send in a second CHLO while processing of the first is still pending. |
| 554 // Verify that the server closes the connection rather than crashing. Note | 553 // Verify that the server closes the connection rather than crashing. Note |
| 555 // that the crash is a use-after-free, so it may only show up consistently in | 554 // that the crash is a use-after-free, so it may only show up consistently in |
| 556 // ASAN tests. | 555 // ASAN tests. |
| 557 EXPECT_CALL( | 556 EXPECT_CALL( |
| 558 *server_connection_, | 557 *server_connection_, |
| 559 CloseConnection(QUIC_CRYPTO_MESSAGE_WHILE_VALIDATING_CLIENT_HELLO, | 558 CloseConnection(QUIC_CRYPTO_MESSAGE_WHILE_VALIDATING_CLIENT_HELLO, |
| 560 "Unexpected handshake message while processing CHLO", _)); | 559 "Unexpected handshake message while processing CHLO", _)); |
| 561 server_stream()->OnHandshakeMessage(chlo); | 560 server_stream()->OnHandshakeMessage(chlo); |
| 562 } | 561 } |
| 563 | 562 |
| 564 } // namespace | 563 } // namespace |
| 565 } // namespace test | 564 } // namespace test |
| 566 } // namespace net | 565 } // namespace net |
| OLD | NEW |