Skip to content

Fix prev_is_cr flag handling in chunked encoding parser#13036

Open
bryancall wants to merge 1 commit intoapache:masterfrom
bryancall:fix/chunked-prev-is-cr
Open

Fix prev_is_cr flag handling in chunked encoding parser#13036
bryancall wants to merge 1 commit intoapache:masterfrom
bryancall:fix/chunked-prev-is-cr

Conversation

@bryancall
Copy link
Copy Markdown
Contributor

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.

This change updates 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

Testing

  • All regression tests pass
  • Added test case to verify proper handling of edge cases 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
Copy link
Copy Markdown
Contributor Author

[approve ci autest 2]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants