The algorithm that computes the tables used in the BM search algorithm sometimes

access an array beyond it's length. This only happens in the last iteration of
a loop, and the value fetched is not used then, so the bug is a relatively
innocent one. Fix this by not fetching any value on the last iteration of said
loop.

Submitted by:	MKI <mki@mozone.net>
MFC after:	1 week
This commit is contained in:
Daniel C. Sobral 2001-11-09 10:17:44 +00:00
parent 93da209126
commit 8e2f75b833

View File

@ -2045,7 +2045,8 @@ struct re_guts *g;
g->mlen + ssuffix - suffix);
suffix++;
}
ssuffix = pmatches[ssuffix];
if (suffix < g->mlen)
ssuffix = pmatches[ssuffix];
}
free(pmatches);