Skip to content
This repository has been archived by the owner on Feb 5, 2025. It is now read-only.

Commit

Permalink
Merge pull request lz4#777 from terrelln/off-by-one
Browse files Browse the repository at this point in the history
[LZ4_compress_destSize] Fix off-by-one error
  • Loading branch information
Cyan4973 authored Aug 10, 2019
2 parents 1bcde64 + d7cad81 commit dfad84c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/lz4.c
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ LZ4_FORCE_INLINE int LZ4_compress_generic(
ip -= matchCode - newMatchCode;
assert(newMatchCode < matchCode);
matchCode = newMatchCode;
if (unlikely(ip < filledIp)) {
if (unlikely(ip <= filledIp)) {
/* We have already filled up to filledIp so if ip ends up less than filledIp
* we have positions in the hash table beyond the current position. This is
* a problem if we reuse the hash table. So we have to remove these positions
Expand Down

0 comments on commit dfad84c

Please sign in to comment.