Fix almost-10-year-old lastIndex bug reported by Sjoerd Visscher <sjoerd@w3future.com> (283477, r=me).
git-svn-id: svn://10.0.0.236/trunk@169775 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
4d92426c5c
commit
f22bc60ebf
@ -1039,8 +1039,8 @@ str_lastIndexOf(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
||||
d = js_DoubleToInteger(d);
|
||||
if (d < 0)
|
||||
i = 0;
|
||||
else if (d > textlen - patlen)
|
||||
i = textlen - patlen;
|
||||
else if (d > textlen)
|
||||
i = textlen;
|
||||
else
|
||||
i = (jsint)d;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user