compression: Use correct value for nibble_index
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Mon, 7 Mar 2022 07:09:40 +0000 (20:09 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 12 May 2022 02:22:35 +0000 (02:22 +0000)
Previously, we were setting this to the wrong value and overwriting
existing output data.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
lib/compression/lzxpress.c
selftest/knownfail.d/lzxpress

index b38e57fa2aee06f72886b54a53c0d93729d2fdb0..0ecb6e23f931874ed3e285e49f497bdb865b6fd5 100644 (file)
@@ -151,10 +151,10 @@ ssize_t lzxpress_compress(const uint8_t *uncompressed,
                                match_len -= 7;
 
                                if (!nibble_index) {
-                                       nibble_index = compressed_pos;
+                                       nibble_index = compressed_pos + metadata_size;
 
                                        __CHECK_BYTES(max_compressed_size, compressed_pos + metadata_size, sizeof(uint8_t));
-                                       compressed[compressed_pos + metadata_size] = MIN(match_len, 15);
+                                       compressed[nibble_index] = MIN(match_len, 15);
                                        metadata_size += sizeof(uint8_t);
                                } else {
                                        __CHECK_BYTES(max_compressed_size, nibble_index, sizeof(uint8_t));
index 3d75b222212aa63fad6f1fdc8c783186d969dab2..0fe7fdba6e0272e3cd9fe7061ab06ec1ba13fa51 100644 (file)
@@ -1,3 +1,2 @@
-samba4.local.compression.lzxpress4
 samba4.local.compression.lzxpress5
 samba4.local.compression.lzxpress6