Bug 1196391, part 3 - Make argument count assertions fatal in js::ExpandErrorArgumentsVA(). r=Waldo

This commit is contained in:
Andrew McCreight 2015-09-03 15:39:09 -07:00
parent 5a58e1556c
commit 1da8beb1bb

View File

@ -584,7 +584,7 @@ js::ExpandErrorArgumentsVA(ExclusiveContext* cx, JSErrorCallback callback,
size_t totalArgsLength = 0;
size_t argLengths[JS::MaxNumErrorArguments]; /* only {0} thru {9} supported */
argCount = efs->argCount;
MOZ_ASSERT(argCount <= JS::MaxNumErrorArguments);
MOZ_RELEASE_ASSERT(argCount <= JS::MaxNumErrorArguments);
if (argCount > 0) {
/*
* Gather the arguments into an array, and accumulate
@ -651,7 +651,7 @@ js::ExpandErrorArgumentsVA(ExclusiveContext* cx, JSErrorCallback callback,
if (*fmt == '{') {
if (isdigit(fmt[1])) {
int d = JS7_UNDEC(fmt[1]);
MOZ_ASSERT(d < argCount);
MOZ_RELEASE_ASSERT(d < argCount);
js_strncpy(out, reportp->messageArgs[d],
argLengths[d]);
out += argLengths[d];