summaryrefslogtreecommitdiffstats
path: root/lib/lz4hc.c
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2022-10-01 07:13:36 (GMT)
committerYann Collet <cyan@fb.com>2022-10-01 07:36:24 (GMT)
commit4dafb855a6d33ffe21b978274e7e650e41c2feda (patch)
tree23fe74a8a0af7b6fbf29b94f9a40ed6ab681810e /lib/lz4hc.c
parente312412c60140b3d061526499cef22e5e99d7751 (diff)
downloadlz4-4dafb855a6d33ffe21b978274e7e650e41c2feda.zip
lz4-4dafb855a6d33ffe21b978274e7e650e41c2feda.tar.gz
lz4-4dafb855a6d33ffe21b978274e7e650e41c2feda.tar.bz2
fixed usan32 tests
the sanitizer was not enabled, due to environment variables not being passed.
Diffstat (limited to 'lib/lz4hc.c')
-rw-r--r--lib/lz4hc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/lz4hc.c b/lib/lz4hc.c
index 33b5de4..651f190 100644
--- a/lib/lz4hc.c
+++ b/lib/lz4hc.c
@@ -257,7 +257,7 @@ LZ4HC_InsertAndGetWiderMatch (
const HCfavor_e favorDecSpeed)
{
U16* const chainTable = hc4->chainTable;
- U32* const HashTable = hc4->hashTable;
+ U32* const hashTable = hc4->hashTable;
const LZ4HC_CCtx_internal * const dictCtx = hc4->dictCtx;
const BYTE* const prefixPtr = hc4->prefixStart;
const U32 prefixIdx = hc4->dictLimit;
@@ -280,8 +280,8 @@ LZ4HC_InsertAndGetWiderMatch (
assert(startpos != NULL);
*startpos = ip; /* in case there is no solution */
/* First Match */
- LZ4HC_Insert(hc4, ip);
- matchIndex = HashTable[LZ4HC_hashPtr(ip)];
+ LZ4HC_Insert(hc4, ip); /* insert all prior positions up to ip (excluded) */
+ matchIndex = hashTable[LZ4HC_hashPtr(ip)];
DEBUGLOG(7, "First candidate match for pos %u found at index %u / %u (lowestMatchIndex)",
ipIndex, matchIndex, lowestMatchIndex);
@@ -293,7 +293,7 @@ LZ4HC_InsertAndGetWiderMatch (
/* do nothing:
* favorDecSpeed intentionally skips matches with offset < 8 */
} else if (matchIndex >= prefixIdx) { /* within current Prefix */
- const BYTE* const matchPtr = prefixPtr + matchIndex - prefixIdx;
+ const BYTE* const matchPtr = prefixPtr + (matchIndex - prefixIdx);
assert(matchPtr < ip);
assert(longest >= 1);
if (LZ4_read16(iLowLimit + longest - 1) == LZ4_read16(matchPtr - lookBackLength + longest - 1)) {