validate quoted-string in parse_chunk_extensions#3102
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #3102 +/- ##
===========================================
- Coverage 93.31% 93.28% -0.03%
===========================================
Files 177 177
Lines 13754 13760 +6
===========================================
+ Hits 12834 12836 +2
- Misses 920 924 +4
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
ashtum
approved these changes
Jun 25, 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.
Quoted chunk-ext values skip character validation
While going over the chunked request path I noticed
parse_chunk_extensionswalks a quoted chunk-ext value looking only for the closing"and a backslash escape, without ever checking the octets in between. The rfc7230 quoted-string grammar only permits qdtext inside the quotes and a qpchar after a backslash, yet the loop accepts anything, so NUL, other control characters, DEL and a bare LF all parse cleanly.param_iteralready validates header-parameter quoted-strings withis_qdchar/is_qpchar; the chunk parser just never got the same treatment.The bare LF is what bothers me here.
find_eolonly recognises CRLF as the chunk-line terminator, so Beast keeps1;a="<LF>"together as a single line, whereas a peer that accepts a lone LF as a line ending would cut the chunk-size line at the LF and disagree about where the next chunk begins, which is the usual shape of a chunked desync. The added regression case in basic_parser.cpp fails on the unpatched parser and passes after; valid quoted extensions still parse.