Skip to content

9.2.x: Fix prev_is_cr flag handling in chunked encoding parser#13038

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

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

Conversation

@bryancall
Copy link
Copy Markdown
Contributor

Backport of #13036 to 9.2.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 requested a review from zwoop as a code owner March 30, 2026 16:32
@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 9.2.x: Fix prev_is_cr flag handling in chunked encoding parser Mar 30, 2026
@ezelkow1 ezelkow1 modified the milestones: 9.2.14, 9.2.13 Mar 30, 2026
@github-project-automation github-project-automation bot moved this from In progress to Ready to Merge in 9.2.x Branch and Release Mar 30, 2026
@zwoop zwoop removed their request for review March 30, 2026 19:44
@ezelkow1 ezelkow1 merged commit e5accd7 into apache:9.2.x Mar 30, 2026
15 checks passed
@ezelkow1 ezelkow1 moved this from Ready to Merge to Done for v9.2.x in 9.2.x Branch and Release Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done for v9.2.x

Development

Successfully merging this pull request may close these issues.

2 participants