I tried to use several implementations, but all of them had bugs.
Search at SO gave me http://www-igm.univ-mlv.fr/~lecroq/string/node14.html - looks nice, but this implementation gave me wrong results - sometimes it doesn't found a string.
I spent couple hours to find the bug.
Following line looks fine:
j += MAX(bmGs[i], bmBc[y[i + j]] - m + 1 + i);
but y is char * and char is signed! It means that y[i + j] could be negative (what happens in one of my tests).
My question is: Where to find correct implementation of Boyer Moore algorithm?