c20078dd798a7d74a676c343823e08aa32611064
MOLO-H2-004 (CVE-2019-9511/9512/9515/9518 class): a client that floods PING frames without draining its socket crashed runtime_interop_server after ~100-150k frames. Root cause, confirmed with an ASan build, is a stack overflow, not heap growth: EventLoop::post()/the Task<T> continuation resume synchronously when work is already buffered, so H2Connection::ReadLoop's frame loop never returns to EventLoop::run_once()'s flat dispatch while a burst of already-read frames remains; each frame nests the native stack one level deeper (ReadLoop -> Ensure -> ReadLoop -> ...) until it overflows. ReadLoop now forces a co_await loop().yield() every caps::kH2FramesPerYield frames, unwinding the stack back to run_once() regardless of burst size. Separately, EnqueueControl/EnqueueData/CompleteResponse had no ceiling on out_queued_bytes_ for H2, unlike the H1 path's out_.size() check in runtime/http/connection.cpp. Added EnforceWriteCap(), using a new, tight caps::kH2MaxPendingControlBytes for control output (PING/SETTINGS acks, RST, WINDOW_UPDATE, GOAWAY) and the existing kWriteBufferCeiling for DATA/response output, same as H1. Because the kernel's own TCP send buffer keeps draining small control frames even while the peer never reads, out_queued_bytes_ alone can stay near zero through a flood, so also added a monotonic caps::kH2MaxControlFramesPerConnection rate cap in EnqueueControl as the mechanism that actually bounds this class of abuse; exceeding either cap drops the connection via Fatal(). audit/MOLO-H2-004 now PASSes repeatably: the connection is cut well before all 300k PINGs are accepted, and the server stays up with bounded RSS. All 134 runtime unit tests (including the H2 suite) still pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Description
moloapp
5.2 MiB
Languages
C++
90%
Python
3.2%
Pawn
3.2%
POV-Ray SDL
1.3%
JavaScript
1.1%
Other
1.1%