LZ4_decompress_fast() : **unsafe!** These functions used to be faster than [LZ4_decompress_safe()](API\Runtime\Core\Compression\LZ4_decompress_safe), but it has changed, and they are now slower than [LZ4_decompress_safe()](API\Runtime\Core\Compression\LZ4_decompress_safe).

Choose your operating system:










#include "Compression/lz4.h"




LZ4void LZ4_resetStream
    LZ4_stream_t * streamPtr


LZ4_decompress_fast() : unsafe! These functions used to be faster than LZ4_decompress_safe(), but it has changed, and they are now slower than LZ4_decompress_safe(). This is because LZ4_decompress_fast() doesn't know the input size, and therefore must progress more cautiously in the input buffer to not read beyond the end of block. On top of that `LZ4_decompress_fast()_ is not protected vs malformed or malicious inputs, making it a security liability. As a consequence, LZ4_decompress_fast() is strongly discouraged, and deprecated.

The last remaining LZ4_decompress_fast() specificity is that it can decompress a block without knowing its compressed size. Such functionality could be achieved in a more secure manner, by also providing the maximum size of input buffer, but it would require new prototypes, and adaptation of the implementation to this new use case.

Parameters: originalSize : is the uncompressed size to regenerate. `dst_ must be already allocated, its size must be >= 'originalSize' bytes.

: LZ4_decompress_fast*() requires originalSize. Thanks to this information, it never writes past the output buffer. However, since it doesn't know its 'src' size, it may read an unknown amount of input, past input buffer bounds. Also, since match offsets are not validated, match reads from 'src' may underflow too. These issues never happen if input (compressed) data is correct. But they may happen if input data is invalid (error or intentional tampering). As a consequence, use these functions in trusted environments with trusted data only.LZ4_resetStream() : An LZ4_stream_t structure must be initialized at least once. This is done with LZ4_initStream(), or LZ4_resetStream(). Consider switching to LZ4_initStream(), invoking LZ4_resetStream() will trigger deprecation warnings in the future.

resetStream is now deprecated, prefer initStream() which is more general


: number of bytes read from source buffer (== compressed size). The function expects to finish at block's end exactly. If the source stream is detected malformed, the function stops decoding and returns a negative result.