Fix Signedness of Comparison
authorW. Felix Handte <w@felixhandte.com>
Thu, 19 Apr 2018 23:36:34 +0000 (19:36 -0400)
committerW. Felix Handte <w@felixhandte.com>
Fri, 20 Apr 2018 00:54:35 +0000 (20:54 -0400)
lib/lz4hc.c

index 9a02787..20df8fa 100644 (file)
@@ -308,7 +308,7 @@ LZ4HC_InsertAndGetWiderMatch (
         ptrdiff_t dictIndexDelta = dictCtx->base - dictCtx->end + lowLimit;
         dictMatchIndex = dictCtx->hashTable[LZ4HC_hashPtr(ip)];
         matchIndex = dictMatchIndex + (int)dictIndexDelta;
-        while (dictMatchIndex + MAX_DISTANCE > ip - base - dictIndexDelta && nbAttempts--) {
+        while ((ptrdiff_t) dictMatchIndex + MAX_DISTANCE > ip - base - dictIndexDelta && nbAttempts--) {
             const BYTE* const matchPtr = dictCtx->base + dictMatchIndex;
 
             if (LZ4_read32(matchPtr) == pattern) {