summaryrefslogtreecommitdiff
path: root/deflate.c
diff options
context:
space:
mode:
Diffstat (limited to 'deflate.c')
-rw-r--r--deflate.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/deflate.c b/deflate.c
index 46f0516..2a32c91 100644
--- a/deflate.c
+++ b/deflate.c
@@ -1216,6 +1216,11 @@ static void lm_init(deflate_state *s) {
* Check that the match at match_start is indeed a match.
*/
void check_match(deflate_state *s, Pos start, Pos match, int length) {
+ /* check that the match length is valid*/
+ if (length < MIN_MATCH || length > MAX_MATCH) {
+ fprintf(stderr, " start %u, match %u, length %d\n", start, match, length);
+ z_error("invalid match length");
+ }
/* check that the match is indeed a match */
if (memcmp(s->window + match, s->window + start, length) != EQUAL) {
fprintf(stderr, " start %u, match %u, length %d\n", start, match, length);