1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00
samba-mirror/lib/compression
Douglas Bagnall 6b4d94c987 compression: fix sign extension of long matches (CID 1517275)
Very long matches would be written instead as very very long matches.

We can't in fact hit this because we have a MAX_MATCH_LENGTH defined
as 64M, but if we could, it might make certain 2GB+ strings impossible
to compress.

  CID 1517275 (#1 of 1): Unintended sign extension
  (SIGN_EXTENSION)sign_extension: Suspicious implicit sign extension:
  intermediate[i + 2UL] with type uint16_t (16 bits, unsigned) is
  promoted in intermediate[i + 2UL] << 16 to type int (32 bits, signed),
  then sign-extended to type unsigned long (64 bits, unsigned). If
  intermediate[i + 2UL] << 16 is greater than 0x7FFFFFFF, the upper bits
  of the result will all be 1.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-12-19 22:32:35 +00:00
..
tests compression tests: avoid div by zero in failure (CID 1517297) 2022-12-19 22:32:35 +00:00
lzxpress_huffman.c compression: fix sign extension of long matches (CID 1517275) 2022-12-19 22:32:35 +00:00
lzxpress_huffman.h lib/compression: LZ77 + Huffman compression 2022-12-01 22:56:39 +00:00
lzxpress.c lib/compression/lzxpress: fix our slow compression 2022-12-02 00:00:04 +00:00
lzxpress.h Move common libraries from root to lib/. 2008-09-17 14:11:12 +02:00
wscript_build lib/comression: convert test_lzxpress_plain to cmocka 2022-12-01 22:56:39 +00:00