Skip to content

Commit

Permalink
Fixed previous match length not reset when match start reset.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmoinvaz authored and Dead2 committed Jan 5, 2021
1 parent f82f9ea commit 446c697
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion deflate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,12 @@ void Z_INTERNAL fill_window(deflate_state *s) {
*/
if (s->strstart >= wsize+MAX_DIST(s)) {
memcpy(s->window, s->window+wsize, (unsigned)wsize);
s->match_start = (s->match_start >= wsize) ? s->match_start - wsize : 0;
if (s->match_start >= wsize) {
s->match_start -= wsize;
} else {
s->match_start = 0;
s->prev_length = 0;
}
s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
s->block_start -= (int)wsize;
if (s->insert > s->strstart)
Expand Down

0 comments on commit 446c697

Please sign in to comment.