Bug 411285 - "js_BoyerMooreHorspool is sometimes called for very short texts" [p=Seno.Aiko@gmail.com r=crowder a1.9=schrep]

git-svn-id: svn://10.0.0.236/trunk@243187 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
reed%reedloden.com
2008-01-16 06:37:13 +00:00
parent e363b58633
commit c5f603b3fc

View File

@@ -1015,7 +1015,7 @@ str_indexOf(JSContext *cx, uintN argc, jsval *vp)
}
/* XXX tune the BMH threshold (512) */
if ((jsuint)(patlen - 2) <= BMH_PATLEN_MAX - 2 && textlen >= 512) {
if (textlen - i >= 512 && (jsuint)(patlen - 2) <= BMH_PATLEN_MAX - 2) {
index = js_BoyerMooreHorspool(text, textlen, pat, patlen, i);
if (index != BMH_BAD_PATTERN)
goto out;