Skip to content

Commit

Permalink
Merge pull request #195 from bryan-m-hughes/timob-13906-1_0_X
Browse files Browse the repository at this point in the history
[TIMOB-13906] Fixed unknown values being passed to function.apply crash
  • Loading branch information
pinnamur committed May 17, 2013
2 parents 97c856b + 7a8b54a commit 20dbff9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
11 changes: 9 additions & 2 deletions lib/Base.js
Original file line number Diff line number Diff line change
Expand Up @@ -5111,6 +5111,7 @@ ObjectProtoToStringFunc,
UndefinedType,
isCallable,
isType,
type,
isObject,
toUint32,
FunctionType,
Expand Down Expand Up @@ -5191,8 +5192,14 @@ FunctionProtoApplyFunc.prototype.callFunction = wrapNativeCall(function callFunc
return new UnknownType();
}

for (i = 0, len = toUint32(argArray.get('length')).value; i < len; i++) {
argList.push(argArray.get(i));
if (type(argArray) === 'Unknown') {
for (i = 0, len = toUint32(this.get('length')).value; i < len; i++) {
argList.push(new UnknownType());
}
} else {
for (i = 0, len = toUint32(argArray.get('length')).value; i < len; i++) {
argList.push(argArray.get(i));
}
}

return thisVal.callFunction(thisArg, argList);
Expand Down
11 changes: 9 additions & 2 deletions lib/base/prototypes/function.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ ObjectProtoToStringFunc,
UndefinedType,
isCallable,
isType,
type,
isObject,
toUint32,
FunctionType,
Expand Down Expand Up @@ -88,8 +89,14 @@ FunctionProtoApplyFunc.prototype.callFunction = wrapNativeCall(function callFunc
return new UnknownType();
}

for (i = 0, len = toUint32(argArray.get('length')).value; i < len; i++) {
argList.push(argArray.get(i));
if (type(argArray) === 'Unknown') {
for (i = 0, len = toUint32(this.get('length')).value; i < len; i++) {
argList.push(new UnknownType());
}
} else {
for (i = 0, len = toUint32(argArray.get('length')).value; i < len; i++) {
argList.push(argArray.get(i));
}
}

return thisVal.callFunction(thisArg, argList);
Expand Down

0 comments on commit 20dbff9

Please sign in to comment.