From: senhuang42 Date: Tue, 10 Nov 2020 18:48:02 +0000 (-0500) Subject: Fix literals length calculation X-Git-Tag: v1.4.7~30^2~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=022e6d81e73261fbcab63337105b261fad721442;p=thirdparty%2Fzstd.git Fix literals length calculation --- diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index a0b6b4254..c19b243c9 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -4587,6 +4587,7 @@ static size_t ZSTD_copySequencesToSeqStore(seqStore_t* seqStore, const ZSTD_sequ break; } else { /* Spanned range ends in the match section */ + litLength = seqRange->startPosInSequence > litLength ? 0 : litLength - seqRange->startPosInSequence; matchLength = seqLength - litLength; }