in cases where the memorized match range from the right factor
exceeded the length of the left factor, it was wrongly treated as a
mismatch rather than a match.
issue reported by Yves Bastide.
(cherry picked from commit
476cd1d96560aaf7f210319597556e7fbcd60469)
}
/* Compare left half */
for (k=ms+1; k>mem && n[k-1] == h[k-1]; k--);
- if (k == mem) return (char *)h;
+ if (k <= mem) return (char *)h;
h += p;
mem = mem0;
}
}
/* Compare left half */
for (k=ms+1; k>mem && n[k-1] == h[k-1]; k--);
- if (k == mem) return (char *)h;
+ if (k <= mem) return (char *)h;
h += p;
mem = mem0;
}
}
/* Compare left half */
for (k=ms+1; k>mem && n[k-1] == h[k-1]; k--);
- if (k == mem) return (wchar_t *)h;
+ if (k <= mem) return (wchar_t *)h;
h += p;
mem = mem0;
}