]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: http-act: ignore "capture len" rules evaluated from a backend
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 23 Sep 2026 04:33:53 +0000 (04:33 +0000)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 23 Sep 2026 12:05:25 +0000 (14:05 +0200)
commit2161c6087926ef4e201978d7520acc001a672c80
treea4fc3a92276ce30cdb624c390694081f0ca53e39
parent0b5ebc47c52c48be83cf3dca6847e866a2f9850f
BUG/MEDIUM: http-act: ignore "capture len" rules evaluated from a backend

An "http-request capture <expr> len <n>" rule creates a capture slot in the
proxy it is declared in. The parser only refuses it in proxies without the
frontend capability, so it is accepted in a "listen" section. But the
capture slots of a stream are allocated from its frontend (s->req_cap is
sized from fe->nb_req_cap), and released through the frontend's capture list
with the frontend's pools.

So when the listen section is also used as the backend of another frontend,
the rule runs with an index taken from the listen's numbering on the slot
array of the other frontend:

  - if this frontend has no capture, s->req_cap is NULL and the first
    request crashes the process;

  - otherwise the slot aliases one of the frontend's slots, it is allocated
    from the listen's pool and later released to the frontend's pool, which
    corrupts the pools. It may also be beyond the end of the slot array.

The slot cannot exist for such streams, so the rule is now ignored when the
proxy evaluating it is not the stream's frontend. This cannot be detected at
parsing time since a backend may be resolved at run time.  The documentation
is updated and a reg-test is added.

This must be backported to all supported versions.
doc/configuration.txt
reg-tests/http-rules/capture_len_listen_as_backend.vtc [new file with mode: 0644]
src/http_act.c