lzxpress: compress shortcut if we've reached maximum length
commit637e7cbdbab6a5229b51954f506e51c677739ce8
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Sun, 15 May 2022 00:28:32 +0000 (15 12:28 +1200)
committerDouglas Bagnall <dbagnall@samba.org>
Tue, 17 May 2022 23:11:21 +0000 (17 23:11 +0000)
tree0426ddfcb7dcd19195bf693f156a1c093f549a4c
parent04309bc68240f55028c7d5108c55625199ad8884
lzxpress: compress shortcut if we've reached maximum length

A simple degenerate case for our compressor has been a large number of
repeated bytes that will match the maximum length (~64k) at all 8192
search positions, 8191 of which searches are in vain because the
matches are not of greater length than the first one.

Here we recognise the inevitable and reduce runtime proportionately.

Credit to OSS-Fuzz.

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=47428

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Tue May 17 23:11:21 UTC 2022 on sn-devel-184
lib/compression/lzxpress.c
selftest/knownfail.d/lzxpress