commit 6121ca16bc83cf74f0c4bc3f71b3150cd18aa43c Merge: 1168e21b4 fcf836d23 Author: Nick Mathewson nickm@torproject.org Date: Tue Aug 8 10:03:08 2017 -0400
Merge remote-tracking branch 'ahf/bugs/22286' into maint-0.3.1
src/common/compress.h | 2 +- src/common/compress_lzma.c | 14 ++++++++++++-- src/common/compress_zstd.c | 16 ++++++++++++++++ src/test/test_util.c | 7 +++++++ 4 files changed, 36 insertions(+), 3 deletions(-)
diff --cc src/common/compress_zstd.c index 94974dec0,f54c4e1b3..5c5026c37 --- a/src/common/compress_zstd.c +++ b/src/common/compress_zstd.c @@@ -307,9 -309,10 +318,10 @@@ tor_zstd_compress_process(tor_zstd_comp state->compress ? "compression" : "decompression", ZSTD_getErrorName(retval)); return TOR_COMPRESS_ERROR; + // LCOV_EXCL_STOP }
- if (state->compress && !finish) { + if (state->compress && !state->have_called_end) { retval = ZSTD_flushStream(state->u.compress_stream, &output);
*out = (char *)output.dst + output.pos; @@@ -319,13 -323,11 +332,14 @@@ log_warn(LD_GENERAL, "Zstandard compression unable to flush: %s.", ZSTD_getErrorName(retval)); return TOR_COMPRESS_ERROR; + // LCOV_EXCL_STOP }
- if (retval > 0) + // ZSTD_flushStream returns 0 if the frame is done, or >0 if it + // is incomplete. + if (retval > 0) { return TOR_COMPRESS_BUFFER_FULL; + } }
if (!finish) {
tor-commits@lists.torproject.org