Fix appending elements for ecma collection (#3719)

During ecma_collection_append the underlying collection
was not increased in the required case. This triggered
a buffer overflow when processing the bound function's arguments
during call or during the Proxy ownKeys method.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
This commit is contained in:
Péter Gál
2020-05-07 16:11:14 +02:00
committed by GitHub
parent 90c7eccb42
commit 18fe546802
3 changed files with 63 additions and 2 deletions
+15
View File
@@ -149,6 +149,21 @@ var proxy = new Proxy(target, handler);
assert(JSON.stringify(Object.getOwnPropertyNames(proxy)) === '["a","a","a"]');
// test with lots of keys
var keyslist = [];
var handler = {
ownKeys: function(target) {
for (var idx = 0; idx < 30; idx++) {
keyslist.push("K" + idx);
}
return keyslist;
}
};
var proxy = new Proxy(target, handler);
assert(JSON.stringify(Object.getOwnPropertyNames(proxy)) === JSON.stringify(keyslist));
// test when invariants gets violated
var target = {
"target_one": 1