Merge branch 'worktree-agent-a9652d841d44d83e5'

This commit is contained in:
2026-10-25 20:28:07 +01:00
3 changed files with 15 additions and 0 deletions
+4
View File
@@ -61,6 +61,10 @@ inline constexpr std::size_t kH2HeaderTableDefault = 4096;
inline constexpr std::size_t kH2HeaderTableCeiling = 16384;
inline constexpr std::size_t kH2HeaderListMax = 65536;
inline constexpr std::size_t kH2MaxFrameHeaderListCap = 100;
// Independent of kH2HeaderListMax (bytes): caps CONTINUATION frame *count*
// for one open header block, so a flood of zero-length CONTINUATION frames
// (near-zero byte growth) cannot evade the byte cap. CVE-2024-27316 class.
inline constexpr std::size_t kH2MaxContinuationFramesPerHeaderBlock = 64;
// 6.5 Compression.
inline constexpr std::size_t kCompressThreshold = 1024;
+8
View File
@@ -407,6 +407,7 @@ bool H2Connection::OnHeaders(const Frame& fr, const char* payload) {
cont_stream_ = fr.stream_id;
cont_buf_.assign(payload + off, len);
cont_end_stream_ = end_stream;
cont_frame_count_ = 0;
return true;
}
return FinishHeaders(fr.stream_id, std::string(payload + off, len),
@@ -462,6 +463,13 @@ bool H2Connection::OnContinuation(const Frame& fr, const char* payload) {
Fatal(kCompressionError);
return false;
}
// Independent of the byte cap above: bounds the number of CONTINUATION
// frames for one header block, so a flood of zero-length frames (which
// never trips the byte cap) still gets cut off. CVE-2024-27316 class.
if (++cont_frame_count_ > caps::kH2MaxContinuationFramesPerHeaderBlock) {
Fatal(kCompressionError);
return false;
}
cont_buf_.append(payload, fr.length);
if (!(fr.flags & kFlagEndHeaders)) return true;
cont_expected_ = false;
+3
View File
@@ -148,6 +148,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;
};