mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-09-21 05:26:20 +02:00
Return TOR_COMPRESS_BUFFER_FULL when zstd has additional input
Fixes #22628.
This commit is contained in:
parent
617e1da636
commit
cbaf0c049c
@ -340,8 +340,20 @@ tor_zstd_compress_process(tor_zstd_compress_state_t *state,
|
|||||||
return TOR_COMPRESS_BUFFER_FULL;
|
return TOR_COMPRESS_BUFFER_FULL;
|
||||||
|
|
||||||
return TOR_COMPRESS_DONE;
|
return TOR_COMPRESS_DONE;
|
||||||
} else {
|
} else /* if (!state->compress) */ {
|
||||||
return (retval == 0) ? TOR_COMPRESS_DONE : TOR_COMPRESS_OK;
|
// ZSTD_decompressStream returns 0 if the frame is done, or >0 if it
|
||||||
|
// is incomplete.
|
||||||
|
// We check this above.
|
||||||
|
tor_assert_nonfatal(!ZSTD_isError(retval));
|
||||||
|
// Start a new frame if this frame is done
|
||||||
|
if (retval == 0)
|
||||||
|
return TOR_COMPRESS_DONE;
|
||||||
|
// Don't check out_len, it might have some space left if the next output
|
||||||
|
// chunk is larger than the remaining space
|
||||||
|
else if (*in_len > 0)
|
||||||
|
return TOR_COMPRESS_BUFFER_FULL;
|
||||||
|
else
|
||||||
|
return TOR_COMPRESS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // HAVE_ZSTD.
|
#else // HAVE_ZSTD.
|
||||||
|
Loading…
Reference in New Issue
Block a user