From c49f66f2adf27af499cf7efacbad656bf30d671a Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Tue, 7 Nov 2017 11:29:28 -0800 Subject: ensure `pattern` is a 1-byte repetition --- lib/lz4hc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/lz4hc.c') diff --git a/lib/lz4hc.c b/lib/lz4hc.c index 5882109d..93017f1f 100644 --- a/lib/lz4hc.c +++ b/lib/lz4hc.c @@ -268,7 +268,8 @@ LZ4_FORCE_INLINE int LZ4HC_InsertAndGetWiderMatch ( if (nextOffset==1) { /* may be a repeated pattern */ if (repeat == rep_untested) { - if ((pattern & 0xFFFF) == (pattern >> 16)) { /* is it enough ? */ + if ( ((pattern & 0xFFFF) == (pattern >> 16)) + & ((pattern & 0xFF) == (pattern >> 24)) ) { repeat = rep_confirmed; srcPatternLength = LZ4HC_countPattern(ip+4, iHighLimit, pattern) + 4; } else { -- cgit v1.2.3