lib:compression: Correctly fix sign extension of long matches (CID 1517275)
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Fri, 6 Oct 2023 02:18:41 +0000 (15:18 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 13 Oct 2023 02:18:30 +0000 (02:18 +0000)
Commit 6b4d94c9877ec59081b9da946c00fa2647cad928 was a previous attempt
to fix this issue.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/compression/lzxpress_huffman.c

index c5da4af0d8578d4d74f942a223aaa84cbb16b790..e14419cd96b191fe66c03cc5ff0056de233b8a8b 100644 (file)
@@ -1049,7 +1049,7 @@ static ssize_t write_compressed_bytes(uint16_t symbol_values[512],
                        }
 
                        len = intermediate[i + 1];
-                       len |= intermediate[i + 2] << 16U;
+                       len |= (uint32_t)intermediate[i + 2] << 16;
                        distance = intermediate[i + 3];
                        i += 3;
                } else if (c == 0xffff) {