Skip to content

Commit 5e618ed

Browse files
committed
fixed a bug with a long rep
1 parent 2815b94 commit 5e618ed

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/lz5hc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ static int LZ5HC_compress_optimal_price (
742742
if (mlen >= MINMATCH)
743743
{
744744
LZ5_LOG_PARSER("%d: start try REP rep=%d mlen=%d\n", (int)((char*)ip-source), rep, mlen);
745-
if (mlen > sufficient_len)
745+
if (mlen > sufficient_len || mlen >= LZ5_OPT_NUM)
746746
{
747747
best_mlen = mlen; best_off = 0; cur = 0; last_pos = 1;
748748
goto encode;
@@ -927,6 +927,7 @@ static int LZ5HC_compress_optimal_price (
927927

928928
LZ5HC_Insert(ctx, inr);
929929
match_num = LZ5HC_GetAllMatches(ctx, inr, ip, matchlimit, best_mlen, matches);
930+
LZ5_LOG_PARSER("%d: LZ5HC_GetAllMatches match_num=%d\n", (int)((char*)inr-source), match_num);
930931

931932
if (match_num > 0 && matches[match_num-1].len > sufficient_len)
932933
{

0 commit comments

Comments
 (0)