From: Nick Mathewson Date: Tue, 8 Aug 2017 14:03:08 +0000 (-0400) Subject: Merge remote-tracking branch 'ahf/bugs/22286' into maint-0.3.1 X-Git-Tag: tor-0.3.1.6-rc~17^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6121ca16bc83cf74f0c4bc3f71b3150cd18aa43c;p=thirdparty%2Ftor.git Merge remote-tracking branch 'ahf/bugs/22286' into maint-0.3.1 --- 6121ca16bc83cf74f0c4bc3f71b3150cd18aa43c diff --cc src/common/compress_zstd.c index 94974dec06,f54c4e1b31..5c5026c37d --- 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) {