Bug 736591 - Check for exceeding the operation limit when iteratively matching a global regexp against a string. r=luke

--HG--
extra : rebase_source : 2a24b4a15909cfd2c04347b60131175fe77e83fe
This commit is contained in:
Jeff Walden 2012-03-27 12:13:13 -07:00
parent 06b198494d
commit 6acfc155bf

View File

@ -1560,6 +1560,8 @@ DoMatch(JSContext *cx, RegExpStatics *res, JSString *str, RegExpShared &re,
if (re.global()) {
RegExpExecType type = (flags & TEST_GLOBAL_BIT) ? RegExpTest : RegExpExec;
for (size_t count = 0, i = 0, length = str->length(); i <= length; ++count) {
if (!JS_CHECK_OPERATION_LIMIT(cx))
return false;
if (!ExecuteRegExp(cx, res, re, linearStr, chars, length, &i, type, rval))
return false;
if (!Matched(type, *rval))