diff options
author | David Goulet <dgoulet@torproject.org> | 2023-08-15 12:39:33 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2023-08-15 12:39:33 -0400 |
commit | 666a272f3f322b6873efed514cadfa381542ce82 (patch) | |
tree | 2ec86744530c617ef04af37c4003a554f350d5c6 | |
parent | 9f8d398f18304ee0b3da1efc0d3175cf5ea3b25e (diff) | |
parent | fd3f9e858045068789603656f4fbd491c2b7dcbc (diff) | |
download | tor-666a272f3f322b6873efed514cadfa381542ce82.tar.gz tor-666a272f3f322b6873efed514cadfa381542ce82.zip |
Merge branch 'maint-0.4.7' into release-0.4.7
-rw-r--r-- | changes/ticket40739 | 6 | ||||
-rw-r--r-- | src/lib/compress/compress_zstd.c | 14 |
2 files changed, 13 insertions, 7 deletions
diff --git a/changes/ticket40739 b/changes/ticket40739 new file mode 100644 index 0000000000..d65c143c56 --- /dev/null +++ b/changes/ticket40739 @@ -0,0 +1,6 @@ + o Minor bugfixes (compression): + - Right after compression/decompression work is done, check for errors. + Before this, we would consider compression bomb before that and then + looking for errors leading to false positive on that log warning. Fixes + bug 40739; bugfix on 0.3.5.1-alpha. Patch by "cypherpunks". + diff --git a/src/lib/compress/compress_zstd.c b/src/lib/compress/compress_zstd.c index 34a2e806f6..85c2bb3bfa 100644 --- a/src/lib/compress/compress_zstd.c +++ b/src/lib/compress/compress_zstd.c @@ -368,6 +368,13 @@ tor_zstd_compress_process(tor_zstd_compress_state_t *state, &output, &input); } + if (ZSTD_isError(retval)) { + log_warn(LD_GENERAL, "Zstandard %s didn't finish: %s.", + state->compress ? "compression" : "decompression", + ZSTD_getErrorName(retval)); + return TOR_COMPRESS_ERROR; + } + state->input_so_far += input.pos; state->output_so_far += output.pos; @@ -383,13 +390,6 @@ tor_zstd_compress_process(tor_zstd_compress_state_t *state, return TOR_COMPRESS_ERROR; } - if (ZSTD_isError(retval)) { - log_warn(LD_GENERAL, "Zstandard %s didn't finish: %s.", - state->compress ? "compression" : "decompression", - ZSTD_getErrorName(retval)); - return TOR_COMPRESS_ERROR; - } - if (state->compress && !state->have_called_end) { retval = ZSTD_flushStream(state->u.compress_stream, &output); |