Skip to content

10.1.x: Fix prev_is_cr flag handling in chunked encoding parser#13037

Merged
cmcfarlen merged 1 commit intoapache:10.1.xfrom
bryancall:backport/chunked-prev-is-cr-10.1.x
Mar 30, 2026
Merged

10.1.x: Fix prev_is_cr flag handling in chunked encoding parser#13037
cmcfarlen merged 1 commit intoapache:10.1.xfrom
bryancall:backport/chunked-prev-is-cr-10.1.x

Conversation

@bryancall
Copy link
Copy Markdown
Contributor

Backport of #13036 to 10.1.x.

Summary

The prev_is_cr flag in ChunkedHandler::read_size() was being set within conditional expressions but not consistently updated, which could cause it to retain stale values across parsing iterations.

Update the flag at the end of each loop iteration to ensure it accurately reflects the current character state. This improves the correctness of line break validation when parsing chunked transfer encoding with strict_chunk_parsing enabled.

Changes

  • Remove inline assignment of prev_is_cr in conditionals
  • Update prev_is_cr at end of loop iteration
  • Add final update when loop exits with remaining data
  • Add test case for edge case in chunked encoding

The prev_is_cr flag in ChunkedHandler::read_size() was being set
within conditional expressions but not consistently updated, which
could cause it to retain stale values across parsing iterations.

Update the flag at the end of each loop iteration to ensure it
accurately reflects the current character state. This improves the
correctness of line break validation when parsing chunked transfer
encoding with strict_chunk_parsing enabled.
@bryancall bryancall added the Bug label Mar 30, 2026
@bryancall bryancall self-assigned this Mar 30, 2026
@bryancall bryancall changed the title Fix prev_is_cr flag handling in chunked encoding parser 10.1.x: Fix prev_is_cr flag handling in chunked encoding parser Mar 30, 2026
@cmcfarlen cmcfarlen merged commit 7c2c689 into apache:10.1.x Mar 30, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants