]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
compression: Use correct values for max len and offset
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Mon, 7 Mar 2022 23:25:59 +0000 (12:25 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 12 May 2022 02:22:35 +0000 (02:22 +0000)
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
lib/compression/lzxpress.c

index 18d0c3183a6007b081d92f584412dc85088349bb..6233e4072ac3eae59d5cfb47b1b4024379c0434c 100644 (file)
@@ -92,12 +92,12 @@ ssize_t lzxpress_compress(const uint8_t *uncompressed,
 
                int32_t offset;
 
-               max_offset = MIN(0x1FFF, max_offset);
+               max_offset = MIN(0x2000, max_offset);
 
                /* search for the longest match in the window for the lookahead buffer */
                for (offset = 1; (uint32_t)offset <= max_offset; offset++) {
                        /* maximum len we can encode into metadata */
-                       uint32_t max_len = MIN(0x1FFF, uncompressed_size - uncompressed_pos);
+                       const uint32_t max_len = MIN(0xFFFF + 3, uncompressed_size - uncompressed_pos);
 
                        uint32_t len;