fix(http): fix server crash on chunked transfer encoding with overflowing chunk size#6802
Merged
bluestreak01 merged 2 commits intomasterfrom Feb 23, 2026
Merged
fix(http): fix server crash on chunked transfer encoding with overflowing chunk size#6802bluestreak01 merged 2 commits intomasterfrom
bluestreak01 merged 2 commits intomasterfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Contributor
[PR Coverage check]😍 pass : 9 / 9 (100.00%) file detail
|
maciulis
pushed a commit
to maciulis/questdb
that referenced
this pull request
Mar 16, 2026
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.
This issue was discovered by Team Atlanta (@LeeSinLiang) 👍
Summary
ChunkedContentParser.parseChunkLength()had no overflow guard on the hexchunk-size parsing loop. A crafted HTTP request with 16+ hex digits in the
chunk size overflows the
long chunkSizeto a negative value, which corruptsthe internal buffer pointer. On the next loop iteration
isEol()dereferencesthe corrupted pointer and the JVM crashes with SIGSEGV.
This is reachable over the network with an unauthenticated
POSTrequestusing
Transfer-Encoding: chunked. The HTTP header parser does not validatechunk sizes — that happens entirely in
ChunkedContentParser, which processesbody data after headers pass validation.
The fix adds an overflow guard before each
chunkSize * 16accumulation step:if
chunkSize > Long.MAX_VALUE >>> 4, the next multiply would overflow apositive
long, so the input is rejected as a protocol violation. The serverlogs the violation and disconnects the client cleanly.
Test plan
ChunkedContentParserTestwith 9 unit tests covering:ddigits)fdigits overflow (0xFFFFFFFFFFFFFFFF = -1)MAX_CHUNK_SIZE_BEFORE_SHIFT + 1)Long.MAX_VALUE= 16 hex digits7fffffffffffffff)fdigits (below boundary, must be accepted)skipEol=falsepath, verifies first chunk data delivered correctly)🤖 Generated with Claude Code