|
|
- commit 3cd7a1ea5110fc6a92627aaad06553a49723ac92
- Author: Christopher Faulet <cfaulet@haproxy.com>
- Date: Mon Jul 29 10:50:28 2019 +0200
-
- BUG/MINOR: htx: Fix free space addresses calculation during a block expansion
-
- When the payload of a block is shrinked or enlarged, addresses of the free
- spaces must be updated. There are many possible cases. One of them is
- buggy. When there is only one block in the HTX message and its payload is just
- before the tail room and it needs to be moved in the head room to be enlarged,
- addresses are not correctly updated. This bug may be hit by the compression
- filter.
-
- This patch must be backported to 2.0.
-
- (cherry picked from commit 61ed7797f6440ee1102576365553650b1982a233)
- Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
-
- diff --git a/src/htx.c b/src/htx.c
- index c29a66d7..cd21050c 100644
- --- a/src/htx.c
- +++ b/src/htx.c
- @@ -252,11 +252,13 @@ static int htx_prepare_blk_expansion(struct htx *htx, struct htx_blk *blk, int32
- ret = 1;
- }
- else if ((sz + delta) < headroom) {
- + uint32_t oldaddr = blk->addr;
- +
- /* Move the block's payload into the headroom */
- blk->addr = htx->head_addr;
- htx->tail_addr -= sz;
- htx->head_addr += sz + delta;
- - if (blk->addr == htx->end_addr) {
- + if (oldaddr == htx->end_addr) {
- if (htx->end_addr == htx->tail_addr) {
- htx->tail_addr = htx->head_addr;
- htx->head_addr = htx->end_addr = 0;
|