Repository navigation
h3: refuse a declared frame length before waiting for its payload - #65
Merged
Merged
Conversation
`frame.Reader.next` consumes a header and then waits for payload, so a peer that declares a 2^30-byte control frame and sends nothing leaves the session waiting. `appendAssembly` never ran, so `H3_EXCESSIVE_LOAD` was never raised and the connection sat until its idle timeout (#64, h3spec's "MUST NOT buffer an over-long frame on a control stream"). `processFrames` now checks the declared length when the header is read, before the payload, for exactly the frames whose payload this session buffers: HEADERS on a request stream and the known control frames. DATA is streamed and an unknown type is ignored however long it declares, which is what #42 settled.
mattrobenolt
force-pushed
the
fix/h3-declared-length
branch
from
November 29, 2026 14:00
a50b289 to
c5055e4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #64, h3spec's last HTTP/3 failure:
MUST NOT buffer an over-long frame on a control stream.h3.frame.Reader.nextparses a header, records the declared length, and waits for payload. A GOAWAY declaring 2^30 bytes and sending none therefore never reachesappendAssembly, which is the only placeH3_EXCESSIVE_LOADwas raised, so the connection sat until its idle timeout while h3spec gave up at two seconds.Session.processFramesnow checks the declared length as soon as the header is read, for exactly the frames whose payload this session buffers:HEADERSon a request stream, and the known control frames. DATA is streamed frame by frame and has no assembled payload; an unknown frame type is ignored however long it declares, which is what #42 settled and what its test now keeps true.The test feeds only the nine header bytes —
\x07\xc0\x00\x00\x00\x40\x00\x00\x00— and requires a connection error withexcessive_load. Disabling the check makes it fail.just cipasses, including the existing #42 test that an unknown frame of 16,385 bytes is still ignored.