]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MEDIUM: flt-decomp: don't expose EOM before the end of decompression
authorOlivier Houchard <ohouchard@haproxy.com>
Tue, 17 Nov 2026 14:38:01 +0000 (15:38 +0100)
committerOlivier Houchard <cognet@ci0.org>
Tue, 17 Nov 2026 14:49:43 +0000 (15:49 +0100)
When the last DATA block carries the EOM flag, which is the case for
Content-Length messages, the decompression filter replaces its compressed
data with the decompressed ones, but the block keeps the EOM flag. If all
the input data were consumed but the decompressed output could not be fully
drained into the buffer, the message is already seen as ended. The filter
is then no longer called and the pending output is lost, silently
truncating the message. Chunked messages are not affected because the EOM
flag is carried by the EOT block, which is held while data are pending.

Let's remove the EOM flag from any DATA block processed by the filter, and
save it in the filter context, so that it is restored once the
decompression is finished, as it is already done when a block is removed.

This was introduced by commit 40e5dff61 ("MAJOR: tree-wide: No longer use
HTX_FL_HAS_EOM to detect end of message"): before it, the end of message was
hidden during the decompression, but since it is carried by the tail block,
it is only saved when the block is removed. No backport is needed.

src/flt_decomp.c

index 56de068d4b3fd1339d6eb948f0fd0416e8852671..a46b0f51052e344c93407587e275071f8d88e787 100644 (file)
@@ -251,6 +251,10 @@ static int decomp_stream_blk(struct stream *s, struct filter *f, struct channel
                        case HTX_BLK_UNUSED:
                                goto next;
                        case HTX_BLK_DATA:
+                               if (blk->flags & HTX_BLK_FL_EOM) {
+                                       blk->flags &= ~HTX_BLK_FL_EOM;
+                                       st->flags |= DECOMP_STATE_EOM_SEEN;
+                               }
                                val = htx_get_blk_value(htx, blk);
                                val = istadv(val, offset);
                                blk_remain = val.len;