Skip to content

Commit

Permalink
gzip: fix wrong usage of address when calculating available size
Browse files Browse the repository at this point in the history
flb_gzip_compress() calculate strm.avail_out while compressing the
buffer. However, it wrongly uses `out_data` which is argument to this
function and likely to be an address of local variable in stack. This
should be `out_buf` which is the start address and to which `pb` belongs
to.

Signed-off-by: Lee Byeoksan <[email protected]>
  • Loading branch information
lee-byeoksan authored and edsiper committed Mar 19, 2020
1 parent 9b13465 commit 86522cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/flb_gzip.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ int flb_gzip_compress(void *in_data, size_t in_len,
flush = Z_NO_FLUSH;
while (1) {
strm.next_out = pb + strm.total_out;
strm.avail_out = out_size - (pb - (uint8_t *) out_data);
strm.avail_out = out_size - (pb - (uint8_t *) out_buf);

if (strm.avail_in == 0) {
flush = Z_FINISH;
Expand Down

0 comments on commit 86522cc

Please sign in to comment.