[TEXTSEARCH]: Fix broken good shift array calculation in Boyer-Moore
authorPablo Neira Ayuso <pablo@netfilter.org>
Fri, 3 Feb 2006 01:15:41 +0000 (17:15 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 3 Feb 2006 01:15:41 +0000 (17:15 -0800)
The current logic does not calculate correctly the good shift array:
Let x be the pattern that is being searched. Let y be the block of data.
The good shift array aligns the segment:

x[i+1 ... m-1] = y[i+j+1 ... j+m-1]

with its rightmost occurrence in x that fulfils x[i] neq y[i+j].

In previous version, the good shift array for the pattern ANPANMAN is:
[1, 8, 3, 8, 8, 8, 8, 8]
and should be:
[1, 8, 3, 6, 6, 6, 6, 6]

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

No differences found