From 022e6d81e73261fbcab63337105b261fad721442 Mon Sep 17 00:00:00 2001 From: senhuang42 Date: Tue, 10 Nov 2020 13:48:02 -0500 Subject: [PATCH] Fix literals length calculation --- lib/compress/zstd_compress.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index a0b6b425..c19b243c 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; }