Fix almost-10-year-old lastIndex bug reported by Sjoerd Visscher <sjoerd@w3future.com> (283477, r=me).

This commit is contained in:
brendan%mozilla.org 2005-02-24 18:59:41 +00:00
Родитель b4253dd8a0
Коммит c1fb1d98d2
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -1039,8 +1039,8 @@ str_lastIndexOf(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
d = js_DoubleToInteger(d); d = js_DoubleToInteger(d);
if (d < 0) if (d < 0)
i = 0; i = 0;
else if (d > textlen - patlen) else if (d > textlen)
i = textlen - patlen; i = textlen;
else else
i = (jsint)d; i = (jsint)d;
} }