From: Olivier Houchard Date: Wed, 2 Dec 2026 14:11:12 +0000 (+0100) Subject: BUG/MEDIUM: flt-decomp: report an error on a truncated payload X-Git-Tag: v3.5.0~10 X-Git-Url: https://git.kaiwu.me/web/ngx_http_auth_basic_module.html?a=commitdiff_plain;h=2ea4347723a38ab23092f89f86491a7c3a120ca3;p=haproxy.git BUG/MEDIUM: flt-decomp: report an error on a truncated payload When the compressed payload is truncated while the HTTP message itself is complete, the decoder never reports the end of the stream and no error was raised. The end of the message was held forever: no timeout applied, the stream was only released when the client left, and depending on the payload size a thread could spin meanwhile. Now, once the whole message was received and all the input was consumed, if flushing the decompression state produces nothing while the decompression is still not finished, an error is returned, as for a corrupted payload. The filter was introduced in 3.5-dev6, so no backport is needed. --- diff --git a/src/flt_decomp.c b/src/flt_decomp.c index aca1fd97b..2a781ceb2 100644 --- a/src/flt_decomp.c +++ b/src/flt_decomp.c @@ -422,6 +422,19 @@ static int decomp_stream_blk(struct stream *s, struct filter *f, struct channel if (ret == -1) goto error; + /* The whole message was received and all the input was + * consumed, but the decompression state was flushed + * with no data produced and the decompression is still + * not finished. It means the compressed payload was + * truncated. Nothing more will come, so it is an + * error. Otherwise, the end of the message would be + * held forever. + */ + if (!blk && ((st->flags & DECOMP_STATE_EOM_SEEN) || htx_msg_ended(htx)) && + !st->decomp_ctx->drain_len && + !(st->decomp_ctx->flags & DECOMP_CTX_FL_DONE)) + goto error; + ret = decomp_stream_blk_drain(s, f, chn, NULL, NULL, 0); total += ret; }