"The last match must start at least 12 bytes before the end of block"
For example, prior to this change, when compressing the following string (ASCII encoded) with lz4js
"AbcdefghijklmnopAbcdefghijk"
a match starting only 11 bytes before the end of the output buffer (corresponding to "Abcdefghijk") would have been created, leading to an invalid output bitstream. Official LZ4 decoder would fail to decompress this bitstream. This commit prevents matches occuring (strictly) less than 12 bytes before the end of the block.
Lz4js compress can produce outputs that are not conformant with LZ4 official format. This is due to end of block conditions spcified in https://github.com/lz4/lz4/blob/dev/doc/lz4_Block_format.md and more specifically the following:
For example, prior to this change, when compressing the following string (ASCII encoded) with lz4js
a match starting only 11 bytes before the end of the output buffer (corresponding to "Abcdefghijk") would have been created, leading to an invalid output bitstream. Official LZ4 decoder would fail to decompress this bitstream. This commit prevents matches occuring (strictly) less than 12 bytes before the end of the block.
Fixes #12