summaryrefslogtreecommitdiffstats
path: root/lib/lz4.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lz4.c')
-rw-r--r--lib/lz4.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/lz4.c b/lib/lz4.c
index 1cd7322..162a36a 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -1931,7 +1931,7 @@ LZ4_decompress_generic(
/* If we're in this block because of the input parsing condition, then we must be on the
* last sequence (or invalid), so we must check that we exactly consume the input.
*/
- if ((ip+length>iend-(2+1+LASTLITERALS)) && (ip+length != iend)) { goto _output_error; }
+ if ((ip+length>iend-(2+1+LASTLITERALS)) && (ip+length != iend) && (cpy != oend)) { goto _output_error; }
assert(ip+length <= iend);
/* We are finishing in the middle of a literals segment.
* Break after the copy.