summaryrefslogtreecommitdiff
path: root/lib/compression
diff options
context:
space:
mode:
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>2022-05-11 12:46:21 +1200
committerAndrew Bartlett <abartlet@samba.org>2022-05-12 02:22:35 +0000
commit1ca444929417a8c86108776bba0ad6be3e5efff1 (patch)
treeb8be149b1748e07fb615ab4ab6d0a68ef0d9a258 /lib/compression
parentd8a90d2a8fc5f42859297c771bc83ec12f45a658 (diff)
downloadsamba-1ca444929417a8c86108776bba0ad6be3e5efff1.tar.gz
compression: fix lzxpress decompress with trailing flags
Every so often, lzxpress adds a 32-bit block of indicator flags to help decode the next clump of 32 code words. A naive compressor (such as we have) might do this at the very end for flags that aren't actually used because there are no more bytes to decompress. If that happens we need to stop processing, or we'll come to worse outcome at the next CHECK_INPUT_BYTES. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'lib/compression')
-rw-r--r--lib/compression/lzxpress.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/compression/lzxpress.c b/lib/compression/lzxpress.c
index de062872560..288fa0bcba8 100644
--- a/lib/compression/lzxpress.c
+++ b/lib/compression/lzxpress.c
@@ -236,6 +236,13 @@ ssize_t lzxpress_decompress(const uint8_t *input,
CHECK_INPUT_BYTES(sizeof(uint32_t));
indicator = PULL_LE_U32(input, input_index);
input_index += sizeof(uint32_t);
+ if (input_index == input_size) {
+ /*
+ * The compressor left room for indicator
+ * flags for data that doesn't exist.
+ */
+ break;
+ }
indicator_bit = 32;
}
indicator_bit--;