Limit args passed via Function ctor (290575, r/a=me).

git-svn-id: svn://10.0.0.236/trunk@172449 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
brendan%mozilla.org
2005-04-19 21:06:26 +00:00
parent 8f9ef563db
commit ec3743ae74

View File

@@ -1783,6 +1783,11 @@ Function(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
fun->nargs)) {
goto bad_formal;
}
if (fun->nargs == JS_BITMASK(16)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
JSMSG_TOO_MANY_FUN_ARGS);
goto bad;
}
fun->nargs++;
/*
@@ -1838,6 +1843,7 @@ bad_formal:
if (!(ts->flags & TSF_ERROR))
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_FORMAL);
bad:
/*
* Clean up the arguments string and tokenstream if we failed to parse
* the arguments.