Flush buffered decoder stream data in qpack_round_trip_fuzzer. EncodingEndpoint destructor CHECKs that all references have been acknowledged. This condition was violated since decoder stream data was delayed at cl/557313748 and cl/582131467. Changing the fuzzing engine to FuzzTests covered this issue, because it flips flags by default when fuzzing. This change allows FuzzTest to be turned back on for qpack_round_trip_fuzzer. Startblock: * BTRGuardian allows cl/583126309 PiperOrigin-RevId: 583465270
diff --git a/quiche/quic/core/qpack/fuzzer/qpack_round_trip_fuzzer.cc b/quiche/quic/core/qpack/fuzzer/qpack_round_trip_fuzzer.cc index b046565..31367b3 100644 --- a/quiche/quic/core/qpack/fuzzer/qpack_round_trip_fuzzer.cc +++ b/quiche/quic/core/qpack/fuzzer/qpack_round_trip_fuzzer.cc
@@ -313,9 +313,11 @@ public VerifyingDecoder::Visitor { public: DecodingEndpoint(uint64_t maximum_dynamic_table_capacity, - uint64_t maximum_blocked_streams) + uint64_t maximum_blocked_streams, + FuzzedDataProvider* provider) : decoder_(maximum_dynamic_table_capacity, maximum_blocked_streams, - &encoder_stream_error_delegate_) {} + &encoder_stream_error_delegate_), + provider_(provider) {} ~DecodingEndpoint() override { // All decoding must have been completed. @@ -385,6 +387,14 @@ it->second->EndHeaderBlock(); } + // Flush decoder stream data buffered within the decoder. + void FlushDecoderStream() { decoder_.FlushDecoderStream(); } + void MaybeFlushDecoderStream() { + if (provider_->ConsumeBool()) { + FlushDecoderStream(); + } + } + private: // EncoderStreamErrorDelegate implementation that crashes on error. class CrashingEncoderStreamErrorDelegate @@ -401,6 +411,7 @@ CrashingEncoderStreamErrorDelegate encoder_stream_error_delegate_; QpackDecoder decoder_; + FuzzedDataProvider* const provider_; // Expected header lists in order for each stream. std::map<QuicStreamId, std::queue<QuicHeaderList>> expected_header_lists_; @@ -593,7 +604,7 @@ // Set up decoder. DecodingEndpoint decoder(maximum_dynamic_table_capacity, - maximum_blocked_streams); + maximum_blocked_streams, &provider); // Transmit encoder stream data from encoder to decoder. DelayedStreamDataTransmitter encoder_stream_transmitter( @@ -639,6 +650,7 @@ for (auto transmit_data_count = provider.ConsumeIntegralInRange(1, 5); transmit_data_count > 0; --transmit_data_count) { encoder_stream_transmitter.MaybeTransmitSomeData(); + decoder.MaybeFlushDecoderStream(); decoder_stream_transmitter.MaybeTransmitSomeData(); header_block_transmitter.MaybeTransmitSomeData(); } @@ -651,6 +663,9 @@ encoder_stream_transmitter.Flush(); // Release all delayed header blocks. header_block_transmitter.Flush(); + // Flush decoder stream data buffered within the decoder. This will then be + // buffered in and delayed by `decoder_stream_transmitter`. + decoder.FlushDecoderStream(); // Release all delayed decoder stream data. decoder_stream_transmitter.Flush();