Repository navigation
[#1786] Fix chunked HTTP framing across prefetch/socket boundaries - #1787
Open
kunaalxoxo wants to merge 1 commit into
Open
kunaalxoxo wants to merge 1 commit into
kunaalxoxo wants to merge 1 commit into
Conversation
Pranav-error
reviewed
Dec 2, 2026
Pranav-error
left a comment
Collaborator
There was a problem hiding this comment.
Head d1720bc. Verified locally (macOS, ASan Debug): split_crlf and extensions_and_trailers fail on the parent and pass here; a 1-2 byte split at every body offset decodes correctly here (parent fails 17/138); 34/34 in -m http.
- The new parser guards aren't covered by the tests. Removing the trailing-garbage check, the
isxdigit/endptrchecks, or the- 1in the line bound still passes all 4 new tests. The- 1one is a 1-byte stack overflow (ASan, http.c:984, on a 4096-byte size line). Can you add cases for5x,+5and a 4096-byte chunk-size line? truncated_trailer_rejectedpasses on the parent as well, so it doesn't catch this regression. Fine to keep, but please don't count it as one.- In the segmented echo server,
send()raises SIGPIPE if the client has closed. On the parent, split_crlf kills the runner (rc 141) instead of reporting FAIL. Can you ignore SIGPIPE or stop at the first failed send? - Nit:
strtoul(..., 16)also accepts0x5, but RFC 9112 chunk-size is HEXDIG only. - Please add yourself to AUTHORS and doc/manual/en/97-acknowledgement.md.
ecleon26
self-requested a review
December 2, 2026 20:42
…aries Signed-off-by: Kunaal Prabhakar Singh Lala <[email protected]>
kunaalxoxo
force-pushed
the
fix-http-chunked-framing-1786
branch
from
December 3, 2026 04:22
d1720bc to
3aa5cc1
Compare
Contributor
Author
|
@Pranav-error Thanks for the thorough review and mutation checks! I've updated the PR (now at
|
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.
Fixes #1786
Summary
http_read_chunked_body()(src/libpgmoneta/http.c) with unifiedhttp_chunk_streamhelpers (http_chunk_read_some,http_chunk_read_exact,http_chunk_read_crlf,http_chunk_read_line).\r\nstraddles the 1-byteprefetchedtail and socket reads, or whenread()/SSL_read()splits\rand\n.1*HEXDIGparsing inhttp_parse_chunk_size()(direct hex digit accumulation withSIZE_MAXoverflow guarding, BWS +;chunk extensions, and rejection of empty input,+/-signs,0xprefixes, and trailing garbage).\r\nline after chunk0.test/testcases/test_http.c:test_pgmoneta_http_chunked_split_crlftest_pgmoneta_http_chunked_extensions_and_trailerstest_pgmoneta_http_chunked_truncated_trailer_header_rejected(catches trailer truncation regression vsmain)test_pgmoneta_http_chunked_invalid_size_rejected(not_hex,5x,+5,0x5, empty line,;ext=1,size_toverflow),test_pgmoneta_http_chunked_oversized_size_line_rejected(4096-byte size line), andtest_pgmoneta_http_chunked_truncated_trailer_rejected.echo_server_thread()againstSIGPIPE(SO_NOSIGPIPE/MSG_NOSIGNAL) and early client closes during segmented sends.AUTHORSanddoc/manual/en/97-acknowledgement.md.Testing
Verified in
pgmoneta-dev:ubuntu24(Clang Debug with ASan):clang-format --dry-run --Werror src/libpgmoneta/http.c test/testcases/test_http.c: passedcppcheck --enable=warning --inline-suppr --quiet --template='{id}:{file}:{line}' -I src/include src/libpgmoneta/http.c: 0 warningscmake --build build -j4: passed./build/test/pgmoneta-test -m http: 36/36 passed./build/test/pgmoneta-test -m walbridge: 64/64 passed