From 3461ad1a2bb9f17ca8d4500950d58552ebcb9d13 Mon Sep 17 00:00:00 2001 From: Ruslan Zakirov Date: Wed, 8 May 2024 12:55:30 +0300 Subject: [PATCH] fix asserts, it's possible that we reach code only with 3 symbols This happens when: * chunked encoding * body is empty * chunk has no extensions * and put calls are really weird --- include/boost/beast/http/impl/basic_parser.ipp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/boost/beast/http/impl/basic_parser.ipp b/include/boost/beast/http/impl/basic_parser.ipp index 1e3a357c..9fd6f96f 100644 --- a/include/boost/beast/http/impl/basic_parser.ipp +++ b/include/boost/beast/http/impl/basic_parser.ipp @@ -701,9 +701,12 @@ parse_chunk_header(char const*& p0, } else { - BOOST_ASSERT(n >= 5); + BOOST_ASSERT(n >= 3); if(f_ & flagExpectCRLF) + { + BOOST_ASSERT(n >= 5); BOOST_VERIFY(parse_crlf(p)); + } std::uint64_t size; BOOST_VERIFY(parse_hex(p, size)); eol = find_eol(p, pend, ec);