Skip to content

h2: client: mark reused mux streams as mux_substream#3632

Open
saghul wants to merge 1 commit into
warmcat:mainfrom
saghul:fix-h2-reused-client-stream-mux-substream
Open

h2: client: mark reused mux streams as mux_substream#3632
saghul wants to merge 1 commit into
warmcat:mainfrom
saghul:fix-h2-reused-client-stream-mux-substream

Conversation

@saghul

@saghul saghul commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

lws_wsi_h2_adopt() set client_mux_substream but not mux_substream on a
reused (pooled) HTTP/2 client stream, whereas the first stream on a
connection carries mux_substream = 1. The HPACK decoder only captures
custom / non-indexed response headers into the ah unknown-header list
(ah->unk_ll_head) when mux_substream is set, so on a reused client stream
those headers are never stored: the unknown-header list is left stale, and
lws_hdr_custom_length/copy/name_foreach then walk it and read out of bounds
(observed as a heap-use-after-free when the walk runs past the ah into an
adjacent freed header table).

This also silently drops all custom response headers on the 2nd+ request of
a pooled h2 client connection.

Set mux_substream on the reused client stream too, matching the first
stream, so HPACK captures custom response headers correctly.

lws_wsi_h2_adopt() set client_mux_substream but not mux_substream on a
reused (pooled) HTTP/2 client stream, whereas the first stream on a
connection carries mux_substream = 1. The HPACK decoder only captures
custom / non-indexed response headers into the ah unknown-header list
(ah->unk_ll_head) when mux_substream is set, so on a reused client stream
those headers are never stored: the unknown-header list is left stale, and
lws_hdr_custom_length/copy/name_foreach then walk it and read out of bounds
(observed as a heap-use-after-free when the walk runs past the ah into an
adjacent freed header table).

This also silently drops all custom response headers on the 2nd+ request of
a pooled h2 client connection.

Set mux_substream on the reused client stream too, matching the first
stream, so HPACK captures custom response headers correctly.
@sonarqubecloud

Copy link
Copy Markdown

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