From 389bf71d42fc6b5373f44704051a3a08a9636ea4 Mon Sep 17 00:00:00 2001 From: Adi Suissa-Peleg Date: Wed, 8 Apr 2020 23:53:58 -0400 Subject: [PATCH] Fixing !pending_response_done_ assertion location in HTTP/1.x codec_impl Signed-off-by: Adi Suissa-Peleg --- source/common/http/http1/codec_impl.cc | 7 ++-- ...ized-codec_impl_fuzz_test-5102523695497216 | 35 +++++++++++++++++++ 2 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 test/common/http/codec_impl_corpus/clusterfuzz-testcase-minimized-codec_impl_fuzz_test-5102523695497216 diff --git a/source/common/http/http1/codec_impl.cc b/source/common/http/http1/codec_impl.cc index 85efa2c111024..05b3b0657a564 100644 --- a/source/common/http/http1/codec_impl.cc +++ b/source/common/http/http1/codec_impl.cc @@ -948,11 +948,12 @@ ClientConnectionImpl::ClientConnectionImpl(Network::Connection& connection, Stat max_response_headers_count, formatter(settings), settings.enable_trailers_) {} bool ClientConnectionImpl::cannotHaveBody() { - if ((pending_response_.has_value() && pending_response_.value().encoder_.headRequest()) || - parser_.status_code == 204 || parser_.status_code == 304 || - (parser_.status_code >= 200 && parser_.content_length == 0)) { + if (pending_response_.has_value() && pending_response_.value().encoder_.headRequest()) { ASSERT(!pending_response_done_); return true; + } else if (parser_.status_code == 204 || parser_.status_code == 304 || + (parser_.status_code >= 200 && parser_.content_length == 0)) { + return true; } else { return false; } diff --git a/test/common/http/codec_impl_corpus/clusterfuzz-testcase-minimized-codec_impl_fuzz_test-5102523695497216 b/test/common/http/codec_impl_corpus/clusterfuzz-testcase-minimized-codec_impl_fuzz_test-5102523695497216 new file mode 100644 index 0000000000000..e23cf3b069a5e --- /dev/null +++ b/test/common/http/codec_impl_corpus/clusterfuzz-testcase-minimized-codec_impl_fuzz_test-5102523695497216 @@ -0,0 +1,35 @@ +actions { + new_stream { + request_headers { + headers { + key: ":method" + value: "GET" + } + headers { + key: ":path" + value: "/" + } + } + } +} +actions { + client_drain { + } +} +actions { + stream_action { + request { + trailers { + } + } + } +} +actions { + stream_action { + response { + headers { + } + end_stream: true + } + } +}