aboutsummaryrefslogtreecommitdiff
path: root/lib/lz4hc.c
diff options
context:
space:
mode:
authorW. Felix Handte <w@felixhandte.com>2018-03-21 11:21:07 -0400
committerW. Felix Handte <w@felixhandte.com>2018-04-19 20:54:35 -0400
commita992d11fc2204b7cb0a70962aa5911a58ed4918c (patch)
tree2b029146f0c845b03fbc0e456befdb3288f8e9e3 /lib/lz4hc.c
parentf895b9a6c69a059e62de8baca39b878ed1031418 (diff)
downloadlz4-a992d11fc2204b7cb0a70962aa5911a58ed4918c.tar.gz
Fully Bounds Check Hash Table Reads
Diffstat (limited to 'lib/lz4hc.c')
-rw-r--r--lib/lz4hc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/lz4hc.c b/lib/lz4hc.c
index 12d26c30..6890613e 100644
--- a/lib/lz4hc.c
+++ b/lib/lz4hc.c
@@ -222,7 +222,7 @@ LZ4HC_InsertAndGetWiderMatch (
DEBUGLOG(7, "First match at index %u / %u (lowLimit)",
matchIndex, lowLimit);
- while ((matchIndex>=lowLimit) && (nbAttempts)) {
+ while ((matchIndex>=lowLimit) && (matchIndex < (ip - base)) && (nbAttempts)) {
DEBUGLOG(7, "remaining attempts : %i", nbAttempts);
nbAttempts--;
if (matchIndex >= dictLimit) {
@@ -286,7 +286,7 @@ LZ4HC_InsertAndGetWiderMatch (
matchIndex -= (U32)backLength; /* let's go to farthest segment position, will find a match of length currentSegmentLength + maybe some back */
}
} } } }
- } /* while ((matchIndex>=lowLimit) && (nbAttempts)) */
+ } /* while ((matchIndex>=lowLimit) && (matchIndex < (ip - base)) && (nbAttempts)) */
return longest;
}