Skip to content

Commit 2e1aa48

Browse files
committed
[MERGE #6065 @akroshg] Fixing Crosssite issue during Array.Concat OS: 18874745
Merge pull request #6065 from akroshg:crosssite We were not marshalling the value while putting into the destination array. Fixed that by marshalling it.
2 parents 71a3562 + fd62760 commit 2e1aa48

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

lib/Runtime/Library/JavascriptArray.inl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,7 @@ namespace Js
480480

481481
inline void JavascriptArray::GenericDirectSetItemAt(const uint32 index, Var newValue)
482482
{
483+
newValue = CrossSite::MarshalVar(this->GetScriptContext(), newValue);
483484
this->DirectSetItemAt(index, newValue);
484485
}
485486

test/Bugs/misc_bugs.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,31 @@ var tests = [
221221
}
222222
}
223223
},
224+
{
225+
name: "CrossSite issue while array concat OS: 18874745",
226+
body: function () {
227+
function test0() {
228+
var IntArr0 = Array();
229+
var sc0Code = `
230+
Object.defineProperty(Array, Symbol.species, { value : function() {
231+
return IntArr0;
232+
}
233+
}
234+
);
235+
test = function(a, list) {
236+
return [a].concat(list);
237+
}
238+
function out() {
239+
test({}, [1]);
240+
}
241+
`;
242+
var sc0 = WScript.LoadScript(sc0Code, 'samethread');
243+
sc0.IntArr0 = IntArr0;
244+
sc0.out();
245+
}
246+
test0();
247+
}
248+
},
224249
{
225250
name: "calling promise's function as constructor should not be allowed",
226251
body: function () {

0 commit comments

Comments
 (0)