From ab713923a24d52a6c3d0835627b3f0d715955467 Mon Sep 17 00:00:00 2001 From: BellaXlp <2273816832@qq.com> Date: Thu, 13 Aug 2020 05:42:10 +0800 Subject: fix issue #783 (#862) * fix issue #783 --- lib/lz4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/lz4.c') 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. -- cgit v1.2.3