]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: mux-h2: Properly consume padding for DATA frames
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 7 May 2026 09:41:51 +0000 (11:41 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 7 May 2026 12:59:28 +0000 (14:59 +0200)
commitfaf3e9ac3a5df7258b0abbc06b0e0378617a18e5
tree6ade36d997f493611a3330cc38186ad0881a80d9
parent72fd357814e1a7618435650580d95709dc4f7e28
BUG/MEDIUM: mux-h2: Properly consume padding for DATA frames

Since the commit 617592c9e ("MEDIUM: mux-h2: try to coalesce outgoing
WINDOW_UPDATE frames"), padding of DATA frames is no longer
consumed. Instead, this padidng is left in the demux buffer and used as the
header of the next frame. Because all bytes of the padding must be zero,
this lead to trigger a PROTOCOL_ERROR because haproxy erroneously thinks the
peer sent a DATA frame for the stream-id 0. It is true for a padding of 9
bytes or more, but similar issues may be exprienced with smaller padding.

Before the commit above, the padding was consumed in h2_process_demux to
restore the H2_CS_FRAME_H state at the end of the while loop processing
received frames.

However, it seems a bit strange to deal with the padding at this stage,
espcially because it is not obvious at all. So to fix the issue, the padding
is now consumed at the end of h2_frt_transfer_data(), inside "end_tranfer"
label. At the stage, we know all payload of the current DATA frame were
consumed and only the padding is still there, if any. We must only take care
to not consume more than available in the demux buffer. The padding may have
been partially received.

This patch should fix the issue #3354. It must be backported as far as 2.8.
src/mux_h2.c