]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: htx: Alloc a chunk of right size in htx_replace_blk_value()
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 20 May 2026 14:13:25 +0000 (16:13 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 20 May 2026 14:21:02 +0000 (16:21 +0200)
commit482b6763a32c37a42ace8f1ede959cba1942afa9
tree0d2f2260ae7b658adc0efb76cbcd9f7d461deff1
parent2a876290528ef8a71401dc51778527ef59266de7
BUG/MEDIUM: htx: Alloc a chunk of right size in htx_replace_blk_value()

Since support for large buffers was added, we must be careful when chunks
are allocated. Indeed, depending on the context a large chunks may be
required if data are copied from a large buffer.

In htx_replace_blk_value() function, when a defragmentation is necessary,
the data to be replaced are copied to a chunk before the
defragmentation. However, I forgot to get large chunk when necessary by
calling alloc_trash_chunk_sz() instead of alloc_trash_chunk(). Because of
this issue, it is possible to copy data to a too small chunk, leading to a
crash.

So let's fix the issue.

Thanks to Vincent55 for finding and reporting this.

No backport needed.
src/htx.c