]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: chunk: fix typo allocating small trash with bufsize_large
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 7 Apr 2026 07:48:10 +0000 (09:48 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 7 Apr 2026 12:20:38 +0000 (14:20 +0200)
commitf712841cf09ecc13cd6e26d161cd2f685d84a4cd
treecea96afc4fd1646b7487a05647b42ae8022214bb
parentd6284470e4420d4c0ce2e65e071e26903b9a9a20
BUG/MEDIUM: chunk: fix typo allocating small trash with bufsize_large

A copy-paste error in alloc_trash_buffers_per_thread() passes
global.tune.bufsize_large to alloc_small_trash_buffers() instead of
global.tune.bufsize_small. This sets small_trash_size = bufsize_large.

When tune.bufsize.large is configured, get_larger_trash_chunk() then
incorrectly matches a large buffer against small_trash_size at line
169 and "grows" it to a regular (smaller) buffer. b_xfer() at line
179 attempts to copy the large buffer's contents into the smaller one:

  - Default builds (DEBUG_STRICT=1): BUG_ON in __b_putblk() aborts
    the process -> remote DoS
  - DEBUG_STRICT=0 builds: BUG_ON becomes ASSUME() and the compiler
    elides the check -> heap overflow with attacker-controlled bytes

Reachable via the json converter (sample.c:2862) when escaping
~bufsize_large/6 control characters in attacker-supplied data such
as a request header or body.

Introduced in commit 92a24a4e875b ("MEDIUM: chunk: Add support for
small chunks"). No backport needed.
src/chunk.c