Skip to content

Commit

Permalink
Fixed flaky Gzip decompression (issue #54)
Browse files Browse the repository at this point in the history
  • Loading branch information
edenhill committed Jan 7, 2014
1 parent 6ff1307 commit 3669be0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions rdgz.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,11 @@ void *rd_gz_decompress (void *compressed, int compressed_len,
goto fail;
}

p += len - strm.avail_out;
len -= len - strm.avail_out;
if (pass == 2) {
/* Advance output pointer (in pass 2). */
p += len - strm.avail_out;
len -= len - strm.avail_out;
}

} while (strm.avail_out == 0 && r != Z_STREAM_END);

Expand Down
2 changes: 1 addition & 1 deletion rdkafka_broker.c
Original file line number Diff line number Diff line change
Expand Up @@ -2342,7 +2342,7 @@ static rd_kafka_resp_err_t rd_kafka_messageset_handle (rd_kafka_broker_t *rkb,

case RD_KAFKA_COMPRESSION_GZIP:
{
uint64_t outlenx;
uint64_t outlenx = 0;

/* Decompress Message payload */
outbuf = rd_gz_decompress(Value->data, Value_len,
Expand Down

0 comments on commit 3669be0

Please sign in to comment.