]> git.99rst.org Git - openwrt-packages.git/blob
3b43d72fc7a083075870722b9a779ebc8808170b
[openwrt-packages.git] /
1 commit 3cd7a1ea5110fc6a92627aaad06553a49723ac92
2 Author: Christopher Faulet <cfaulet@haproxy.com>
3 Date: Mon Jul 29 10:50:28 2019 +0200
4
5 BUG/MINOR: htx: Fix free space addresses calculation during a block expansion
6
7 When the payload of a block is shrinked or enlarged, addresses of the free
8 spaces must be updated. There are many possible cases. One of them is
9 buggy. When there is only one block in the HTX message and its payload is just
10 before the tail room and it needs to be moved in the head room to be enlarged,
11 addresses are not correctly updated. This bug may be hit by the compression
12 filter.
13
14 This patch must be backported to 2.0.
15
16 (cherry picked from commit 61ed7797f6440ee1102576365553650b1982a233)
17 Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
18
19 diff --git a/src/htx.c b/src/htx.c
20 index c29a66d7..cd21050c 100644
21 --- a/src/htx.c
22 +++ b/src/htx.c
23 @@ -252,11 +252,13 @@ static int htx_prepare_blk_expansion(struct htx *htx, struct htx_blk *blk, int32
24 ret = 1;
25 }
26 else if ((sz + delta) < headroom) {
27 + uint32_t oldaddr = blk->addr;
28 +
29 /* Move the block's payload into the headroom */
30 blk->addr = htx->head_addr;
31 htx->tail_addr -= sz;
32 htx->head_addr += sz + delta;
33 - if (blk->addr == htx->end_addr) {
34 + if (oldaddr == htx->end_addr) {
35 if (htx->end_addr == htx->tail_addr) {
36 htx->tail_addr = htx->head_addr;
37 htx->head_addr = htx->end_addr = 0;
git clone https://git.99rst.org/PROJECT