Fix leak in Array.prototype.indexOf() when 'fromIndex' can't coerce to primitive value.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai [email protected]
This commit is contained in:
Dániel Bátyai authored and Evgeny Gavrin committed 2015-07-24 10:31:37 +03:00
1 parent 11c310322b
commit 27161d31df
2 files changed
+30 -18

No files matched your search

+17
View File
@@ -45,6 +45,23 @@ assert(obj.indexOf("foo") === -1);
var arr = [11, 22, 33, 44];
assert(arr.indexOf(44, 4) === -1);
var fromIndex = {
toString: function () {
return {};
},
valueOf: function () {
return {};
}
};
try {
[0, 1].indexOf(1, fromIndex);
assert(false);
} catch (e) {
assert(e instanceof TypeError);
}
// Checking behavior when unable to get length
var obj = { indexOf : Array.prototype.indexOf}
Object.defineProperty(obj, 'length', { 'get' : function () { throw new ReferenceError ("foo"); } });