fix(runtime): cap CONTINUATION frame count per header block (MOLO-H2-003)

kH2HeaderListMax only bounded accumulated header bytes across HEADERS plus
CONTINUATION frames, so an attacker could flood zero-length CONTINUATION
frames on an open header block (CVE-2024-27316 class) forever without
tripping the byte cap, each still costing a 9-byte frame parse. Add an
independent kH2MaxContinuationFramesPerHeaderBlock cap in caps.h and
enforce it in H2Connection::OnContinuation, closing the connection via the
same Fatal(kCompressionError) GOAWAY path already used for the byte cap.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-10-25 20:06:37 +01:00
co-authored by Claude Sonnet 5
parent 16a0bb0de4
commit 11ae3ce4a5
3 changed files with 15 additions and 0 deletions
+3
View File
@@ -145,6 +145,9 @@ class H2Connection : public std::enable_shared_from_this<H2Connection> {
uint32_t cont_stream_ = 0;
std::string cont_buf_;
bool cont_end_stream_ = false;
// Count of CONTINUATION frames seen for the currently open header block;
// independent of cont_buf_'s byte size. See kH2MaxContinuationFramesPerHeaderBlock.
std::size_t cont_frame_count_ = 0;
std::coroutine_handle<> window_waiter_ = nullptr;
std::coroutine_handle<> writer_done_waiter_ = nullptr;
};