h2: client: mark reused mux streams as mux_substream#3632
Open
saghul wants to merge 1 commit into
Open
Conversation
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.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



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.