BUG/MEDIUM: mux-h2: make sure not to touch dummy streams when sending WU
authorWilly Tarreau <w@1wt.eu>
Thu, 5 Dec 2024 14:18:38 +0000 (15:18 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 5 Dec 2024 14:36:24 +0000 (15:36 +0100)
commit0f0c40fa7b58898c1d93bcd118034583cc5843a6
treee67c268f4bb23c3de31a03dbc0d211b0de5babc1
parent17e3fc9ab6e47cf31aa050834039ae991f82e74f
BUG/MEDIUM: mux-h2: make sure not to touch dummy streams when sending WU

Since commit 1cc851d9f2 ("MEDIUM: mux-h2: start to update stream when
sending WU") we started storing stream offsets in the h2s struct. These
offsets are updated at a few points, where it's safe to write to the
stream, and in h2c_send_strm_wu(), where the h2s->h2c was not performed.

Due to this, nothing protects the h2s from being updated when sending a
WU for a closed stream, which might only happen when acknowledging a
frame after resetting that stream, which is quite unlikely. In any case
if this happens, it will crash as in issue #2793 since the closed streams
are purposely read-only to catch such bugs.

The fix is trivial, just check h2s->h2c before deciding to update the
stream.

Thanks to @Wahnes for reporting this, and Christopher for spotting the
cause. This needs to be backported to 3.1 only.

(cherry picked from commit d649278fce9729415b31e873a3b91d6d0b259d16)
Signed-off-by: Willy Tarreau <w@1wt.eu>
src/mux_h2.c