Skip to content

HAProxy: Fix ByteBuf leak when parsing nested SSL TLVs#16881

Merged
normanmaurer merged 2 commits into
4.1from
h41
Jun 2, 2026
Merged

HAProxy: Fix ByteBuf leak when parsing nested SSL TLVs#16881
normanmaurer merged 2 commits into
4.1from
h41

Conversation

@normanmaurer
Copy link
Copy Markdown
Member

Motivation:

When parsing a PROXY protocol v2 header containing nested PP2_TYPE_SSL TLVs
at depth two or greater, the underlying cumulation buffer can remain
retained after the message is deallocated. This happens because deeply nested
TLVs are not flattened into the main tlvs() list, causing them to be missed
during the standard release process.

Modifications:

  • Update the release logic in HAProxyMessage to correctly identify and
    recursively release deeply nested TLVs.
  • Introduce a releaseTlvs helper method to handle the recursive release
    without altering the existing public API behavior of the tlvs() list.

Result:

The cumulation buffer is properly released when handling deeply nested
SSL TLVs, preventing memory leaks while preserving backwards compatibility.

Motivation:

When parsing a PROXY protocol v2 header containing nested PP2_TYPE_SSL TLVs
at depth two or greater, the underlying cumulation buffer can remain
retained after the message is deallocated. This happens because deeply nested
TLVs are not flattened into the main tlvs() list, causing them to be missed
during the standard release process.

Modifications:

- Update the release logic in HAProxyMessage to correctly identify and
  recursively release deeply nested TLVs.
- Introduce a releaseTlvs helper method to handle the recursive release
  without altering the existing public API behavior of the tlvs() list.

Result:

The cumulation buffer is properly released when handling deeply nested
SSL TLVs, preventing memory leaks while preserving backwards compatibility.
@normanmaurer normanmaurer added this to the 4.1.135.Final milestone Jun 1, 2026
@normanmaurer normanmaurer added the needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. label Jun 1, 2026
@normanmaurer normanmaurer merged commit bd6214f into 4.1 Jun 2, 2026
18 checks passed
@normanmaurer normanmaurer deleted the h41 branch June 2, 2026 13:27
@netty-project-bot
Copy link
Copy Markdown
Contributor

Could not create auto-port PR.
Got conflicts when cherry-picking onto 5.0.

@chrisvest
Copy link
Copy Markdown
Member

Port to 5.0: #16914

@chrisvest chrisvest removed the needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. label Jun 4, 2026
chrisvest added a commit that referenced this pull request Jun 5, 2026
- #16881
- #16876
- #16866
- #16870
- #16837
- #16858
- #16882
- #16893

---------

Co-authored-by: Norman Maurer <[email protected]>
Co-authored-by: Violeta Georgieva <[email protected]>
Co-authored-by: Szymon Habrainski <[email protected]>
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.

4 participants