summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2017-11-07 19:29:28 (GMT)
committerYann Collet <cyan@fb.com>2017-11-07 19:29:28 (GMT)
commitc49f66f2adf27af499cf7efacbad656bf30d671a (patch)
treeafdb8e499f6a514fbbe5196962ddabcd17ecbc82 /lib
parent5512a5f1a932d4d906f3bbecf1932863bcac7b2b (diff)
downloadlz4-c49f66f2adf27af499cf7efacbad656bf30d671a.zip
lz4-c49f66f2adf27af499cf7efacbad656bf30d671a.tar.gz
lz4-c49f66f2adf27af499cf7efacbad656bf30d671a.tar.bz2
ensure `pattern` is a 1-byte repetition
Diffstat (limited to 'lib')
-rw-r--r--lib/lz4hc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/lz4hc.c b/lib/lz4hc.c
index 5882109..93017f1 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 {