Skip to content

HTTPDecoder: Preserve maxHeaderFieldSize accounting across header name/value transition - #3690

Open
5H4D0WBY73 wants to merge 2 commits into
apple:mainfrom
5H4D0WBY73:fix-header-field-accounting
Open

HTTPDecoder: Preserve maxHeaderFieldSize accounting across header name/value transition#3690
5H4D0WBY73 wants to merge 2 commits into
apple:mainfrom
5H4D0WBY73:fix-header-field-accounting

Conversation

@5H4D0WBY73

Copy link
Copy Markdown

Summary

This PR fixes the accounting of maxHeaderFieldSize across the header name → header value transition.

Previously, finish() was called when transitioning from headerName to headerValue, which reset currentFieldByteLength before the header value was parsed. As a result, maxHeaderFieldSize was enforced independently on the header name and header value instead of on the complete header field, contrary to the documented behavior.

This change introduces a flush() helper that forwards the accumulated bytes without resetting currentFieldByteLength. finish() now delegates to flush() before resetting the counter, and the header name → header value transition uses flush() instead of finish().

As a result, the byte counter is preserved across the transition and maxHeaderFieldSize is enforced on the complete header field (name + value) as documented.

Changes

  • Introduce flush() to separate flushing from counter reset.
  • Preserve currentFieldByteLength across the header name → header value transition.
  • Keep existing reset behavior for completed header fields and other parser states.

This PR implements the fix discussed in GHSA-f4r8-q66f-vf84.

Preserve currentFieldByteLength across the header name → header value transition so maxHeaderFieldSize is enforced across the complete header field.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant