Files
codeql/javascript/ql/test/library-tests/TaintTracking/array-mutation.js
Asger F cf23c50f0c JS: Add convenience layer
Adds getASpreadArgument() and defines getCalleeName() for reflective
calls to be the name of the property being invoked, if there is one.
2019-07-11 10:55:28 +01:00

38 lines
603 B
JavaScript

function test(x, y) {
let a = [];
a.splice(source(), x);
sink(a); // OK
let b = [];
b.splice(x, source());
sink(b); // OK
let c = [];
c.splice(source(), x, y);
sink(c); // OK
let d = [];
d.splice(x, source(), y);
sink(d); // OK
let e = [];
e.splice(x, y, source());
sink(e); // NOT OK
let f = [];
f.push(...source());
sink(f); // NOT OK
let g = [];
g.unshift(...source());
sink(g); // NOT OK
let h = [];
Array.prototype.push.apply(h, source());
sink(h); // NOT OK
let i = [];
Array.prototype.unshift.apply(i, source());
sink(i); // NOT OK
}