summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorYann Collet <Cyan4973@users.noreply.github.com>2019-07-15 16:08:11 (GMT)
committerGitHub <noreply@github.com>2019-07-15 16:08:11 (GMT)
commita23541463d924f11dfc0843f4ddb10a1e777e405 (patch)
tree7dc5c426fcad717cd467b16fab049dfb073b471a /lib
parentf1e8e806e0dd753eb48e40272e620f747c7b723e (diff)
parent8ac954aa71edd5c13a0b9f6ab57eaece75efc28d (diff)
downloadlz4-a23541463d924f11dfc0843f4ddb10a1e777e405.zip
lz4-a23541463d924f11dfc0843f4ddb10a1e777e405.tar.gz
lz4-a23541463d924f11dfc0843f4ddb10a1e777e405.tar.bz2
Merge pull request #753 from Hitatm/fix_LZ4_DISTANCE_MAX
bugfix: correctly control the offset < LZ4_DISTANCE_MAX,when change t…
Diffstat (limited to 'lib')
-rw-r--r--lib/lz4hc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/lz4hc.c b/lib/lz4hc.c
index 936f739..46c20bc 100644
--- a/lib/lz4hc.c
+++ b/lib/lz4hc.c
@@ -228,7 +228,7 @@ LZ4HC_InsertAndGetWiderMatch (
const U32 dictLimit = hc4->dictLimit;
const BYTE* const lowPrefixPtr = base + dictLimit;
const U32 ipIndex = (U32)(ip - base);
- const U32 lowestMatchIndex = (hc4->lowLimit + 64 KB > ipIndex) ? hc4->lowLimit : ipIndex - LZ4_DISTANCE_MAX;
+ const U32 lowestMatchIndex = (hc4->lowLimit + (LZ4_DISTANCE_MAX + 1) > ipIndex) ? hc4->lowLimit : ipIndex - LZ4_DISTANCE_MAX;
const BYTE* const dictBase = hc4->dictBase;
int const lookBackLength = (int)(ip-iLowLimit);
int nbAttempts = maxNbAttempts;