Skip to content

Commit

Permalink
Fix out-of-bound access of zng_length_codes.
Browse files Browse the repository at this point in the history
  • Loading branch information
mtl1979 authored and Dead2 committed May 7, 2023
1 parent bf985ad commit f346148
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions deflate_quick.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ Z_INTERNAL block_state deflate_quick(deflate_state *s, int flush) {
if (match_len >= WANT_MIN_MATCH) {
if (UNLIKELY(match_len > s->lookahead))
match_len = s->lookahead;
if (UNLIKELY(match_len > STD_MAX_MATCH))
match_len = STD_MAX_MATCH;

check_match(s, s->strstart, hash_head, match_len);

Expand Down
1 change: 1 addition & 0 deletions deflate_rle.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Z_INTERNAL block_state deflate_rle(deflate_state *s, int flush) {
scan < strend);
match_len = STD_MAX_MATCH - (unsigned int)(strend - scan);
match_len = MIN(match_len, s->lookahead);
match_len = MIN(match_len, STD_MAX_MATCH);
}
Assert(scan <= s->window + s->window_size - 1, "wild scan");
}
Expand Down

0 comments on commit f346148

Please sign in to comment.