]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: flt-decomp: don't leave an empty DATA block when draining
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 30 Nov 2026 13:36:33 +0000 (14:36 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 30 Nov 2026 15:03:42 +0000 (16:03 +0100)
commit682ba15b3fecf6567f52fc6028c703fdf59252ac
tree365b558b47500212ad1f53725abc6ef0d1f9f727
parent55d77d18a88446f9797b10852396dd470dedc8db
BUG/MINOR: flt-decomp: don't leave an empty DATA block when draining

When there is not enough room to drain the decompressed data,
decomp_stream_blk_drain() replaces the fully consumed part of the DATA
block with the drained data. But if nothing could be drained, i.e. the
drainable length is 0, and the block was fully consumed, the block was
left empty in the HTX message. Similarly, when the function is called
without a block, because there is no DATA block to drain into, a
zero-sized DATA block could be added if nothing was drainable.

An empty DATA block is not supposed to remain in an HTX message. For a
chunked message, mux-h1 would emit a zero-sized chunk, i.e. the
last-chunk, prematurely ending the message for the client and making
it interpret any remaining data as a new message (response splitting).

So, when the block is fully consumed and nothing can be drained in its
place, the block is now removed instead of being emptied, taking care
of the EOM flag, if the block was carrying it. And when there is no
block to drain into, nothing is added if nothing is drainable. This
latter case is handled by htx_add_last_data() which refuses empty data.

This is a latent bug, no way was found to trigger it with a
well-behaving client or server, but the HTX API is about to enforce the
no-empty-data-block invariant, so the filter must behave accordingly.

No backport needed.
src/flt_decomp.c