zstd/lib/decompress
Nick Terrell 036b30b555
Fix super block compression and stream raw blocks in decompression (#1947)
Super blocks must never violate the zstd block bound of input_size + ZSTD_blockHeaderSize. The individual sub-blocks may, but not the super block. If the superblock violates the block bound we are liable to violate ZSTD_compressBound(), which we must not do. Whenever the super block violates the block bound we instead emit an uncompressed block.

This means we increase the latency because of the single uncompressed block. I fix this by enabling streaming an uncompressed block, so the latency of an uncompressed block is 1 byte. This doesn't reduce the latency of the buffer-less API, but I don't think we really care.

* I added a test case that verifies that the decompression has 1 byte latency.
* I rely on existing zstreamtest / fuzzer / libfuzzer regression tests for correctness. During development I had several correctness bugs, and they easily caught them.
* The added assert that the superblock doesn't violate the block bound will help us discover any missed conditions (though I think I got them all).

Credit to OSS-Fuzz.
2020-01-10 18:02:11 -08:00
..
huf_decompress.c Optimize decompression speed for gcc and clang (#1892) 2019-11-25 18:26:19 -08:00
zstd_ddict.c Rename FORWARD_ERROR -> FORWARD_IF_ERROR 2019-01-29 12:56:07 -05:00
zstd_ddict.h added comment on public ddict functions 2018-10-24 16:50:03 -07:00
zstd_decompress_block.c Optimize decompression speed for gcc and clang (#1892) 2019-11-25 18:26:19 -08:00
zstd_decompress_block.h added a few comments for clarifications 2018-10-26 15:21:52 -07:00
zstd_decompress_internal.h Use ZSTD Error codes, improve explanation of ZSTD_loadCEntropy() and ZSTD_loadDEntropy() 2019-11-08 13:57:26 -05:00
zstd_decompress.c Fix super block compression and stream raw blocks in decompression (#1947) 2020-01-10 18:02:11 -08:00