zstd
zstd copied to clipboard
zstdcat should return all decompressable data even if frame is incomplete
This issue manifests as truncated data when using zstdcat on some files that have an unterminated frame.
When the frame is unterminated, ZSTD_decompressStream does not keep hostage input bytes. In circumstances where the input buffer has been cleared, but not all data have been written to the output buffer, zstdcat should continue to call ZSTD_decompressStream to write out all data that's been decompressed before erroring out.
https://github.com/facebook/zstd/blob/c28031df8f1809621407b5bc9c4b3e052872409f/programs/fileio.c#L2391