[lz4hc] Improve pattern detection in ext dict
authorNick Terrell <terrelln@fb.com>
Tue, 30 Jul 2019 22:16:35 +0000 (15:16 -0700)
committerNick Terrell <terrelln@fb.com>
Wed, 31 Jul 2019 17:16:21 +0000 (10:16 -0700)
commit7e97bf377d3c3a6d0d71a3ce9116e1f0143a8740
tree6456eeed7e4073c4c260429c3ca1744d17b39cf2
parentce9176a68d13345d38e8362608850c64ebb6d896
[lz4hc] Improve pattern detection in ext dict

It is important to continue to look backwards if the current pattern
reaches `lowPrefixPtr`. If the pattern detection doesn't go all the
way to the beginning of the pattern, or the end of the pattern it
slows down the search instead of speeding it up.

The slow unit in `round_trip_stream_fuzzer` used to take 12 seconds
to run with -O3, now it takes 0.2 seconds.

Credit to OSS-Fuzz
lib/lz4hc.c