From: Hitatm Date: Mon, 15 Jul 2019 14:53:46 +0000 (+0800) Subject: bugfix: correctly control the offset < LZ4_DISTANCE_MAX,when change the value of... X-Git-Tag: upstream/1.9.3~2^2~14^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8ac954aa71edd5c13a0b9f6ab57eaece75efc28d;p=platform%2Fupstream%2Flz4.git bugfix: correctly control the offset < LZ4_DISTANCE_MAX,when change the value of LZ4_DISTANCE_MAX, --- 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;