diff options
author | Dave Rodgman <dave.rodgman@arm.com> | 2019-04-05 18:38:58 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-04-05 16:02:30 -1000 |
commit | b11ed18efa8f3dc58b259b812588317b765b1cfc (patch) | |
tree | f98183968067ec487a0fd4e732d3fa7ac7ff29cf /Documentation/lzo.txt | |
parent | 6147e136ff5071609b54f18982dea87706288e21 (diff) | |
download | linux-b11ed18efa8f3dc58b259b812588317b765b1cfc.tar.gz linux-b11ed18efa8f3dc58b259b812588317b765b1cfc.tar.bz2 linux-b11ed18efa8f3dc58b259b812588317b765b1cfc.zip |
lib/lzo: fix bugs for very short or empty input
For very short input data (0 - 1 bytes), lzo-rle was not behaving
correctly. Fix this behaviour and update documentation accordingly.
For zero-length input, lzo v0 outputs an end-of-stream marker only,
which was misinterpreted by lzo-rle as a bitstream version number.
Ensure bitstream versions > 0 require a minimum stream length of 5.
Also fixes a bug in handling the tail for very short inputs when a
bitstream version is present.
Link: http://lkml.kernel.org/r/20190326165857.34613-1-dave.rodgman@arm.com
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/lzo.txt')
-rw-r--r-- | Documentation/lzo.txt | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Documentation/lzo.txt b/Documentation/lzo.txt index f79934225d8d..ca983328976b 100644 --- a/Documentation/lzo.txt +++ b/Documentation/lzo.txt @@ -102,9 +102,11 @@ Byte sequences dictionary which is empty, and that it will always be invalid at this place. - 17 : bitstream version. If the first byte is 17, the next byte - gives the bitstream version (version 1 only). If the first byte - is not 17, the bitstream version is 0. + 17 : bitstream version. If the first byte is 17, and compressed + stream length is at least 5 bytes (length of shortest possible + versioned bitstream), the next byte gives the bitstream version + (version 1 only). + Otherwise, the bitstream version is 0. 18..21 : copy 0..3 literals state = (byte - 17) = 0..3 [ copy <state> literals ] |