fprintf(stderr, " start %u, match %u, length %d\n", start, match, length);
z_error("invalid match length");
}
+ /* check that the match isn't at the beginning of the window and that it isn't at
+ * the same position as the start string
+ */
+ if (match == 0 || match == start) {
+ fprintf(stderr, " start %u, match %u, length %d\n", start, match, length);
+ z_error("invalid match position");
+ }
/* check that the match is indeed a match */
if (memcmp(s->window + match, s->window + start, length) != EQUAL) {
int32_t i = 0;