]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: compression: Use the right buffer pointers to compress input data
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 17 Dec 2018 11:02:57 +0000 (12:02 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 17 Dec 2018 12:46:38 +0000 (13:46 +0100)
A bug was introduced when the buffers API was refactored. It was when wrapping
input data were compressed. the pointer b_peek(in, 0) was used instead of
"b_orig(in)". b_peek(in, 0) is in fact the same as b_head(in).

src/flt_http_comp.c

index 017080961e9cf7b1d6ac3f17a1e9fafc80e234b5..48730560501036f14b01d8795c24880aef207468 100644 (file)
@@ -1074,10 +1074,10 @@ http_compression_buffer_add_data(struct comp_state *st, struct buffer *in,
        block2 = data_process_len - block1;
 
        /* compressors return < 0 upon error or the amount of bytes read */
-       consumed_data = st->comp_algo->add_data(st->comp_ctx, b_head(in) + in_out, block1, out);
+       consumed_data = st->comp_algo->add_data(st->comp_ctx, b_peek(in, in_out), block1, out);
        if (consumed_data != block1 || !block2)
                goto end;
-       consumed_data = st->comp_algo->add_data(st->comp_ctx, b_peek(in, 0), block2, out);
+       consumed_data = st->comp_algo->add_data(st->comp_ctx, b_orig(in), block2, out);
        if (consumed_data < 0)
                goto end;
        consumed_data += block1;