Skip to content

Commit 787d0cc

Browse files
committed
Refactor Array#splice method to use global variable reference for call retrieval
1 parent 8b431dc commit 787d0cc

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

javascript/ql/lib/semmle/javascript/internal/flow_summaries/Arrays.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ class Sort extends SummarizedCallable {
512512
class Splice extends SummarizedCallable {
513513
Splice() { this = "Array#splice" }
514514

515-
override InstanceCall getACallSimple() { result.getMethodName() = "splice" }
515+
override InstanceCall getACallSimple() { result = DataFlow::globalVarRef(["splice"]).getACall() }
516516

517517
override predicate propagatesFlow(string input, string output, boolean preservesValue) {
518518
preservesValue = true and

javascript/ql/test/library-tests/TripleDot/underscore.string.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function strToStr() {
1111
sink(s.unescapeHTML(source("s8"))); // $ hasTaintFlow=s8
1212
sink(s.wrap(source("s9"), {})); // $ hasTaintFlow=s9
1313
sink(s.dedent(source("s10"), " ")); // $ hasTaintFlow=s10
14-
sink(s.reverse(source("s11"))); // $ hasTaintFlow=s11 SPURIOUS: hasTaintFlow=s8
14+
sink(s.reverse(source("s11"))); // $ hasTaintFlow=s11
1515
sink(s.pred(source("s12"))); // $ hasTaintFlow=s12
1616
sink(s.succ(source("s13"))); // $ hasTaintFlow=s13
1717
sink(s.titleize(source("s14"))); // $ hasTaintFlow=s14
@@ -60,7 +60,7 @@ function multiSource() {
6060
sink(s.join(",", source("s5"), "str")); // $ hasTaintFlow=s5
6161
sink(s.join(",", "str", source("s6"))); // $ hasTaintFlow=s6
6262

63-
sink(s.splice(source("s7"), 1, 2, "str")); // $ hasTaintFlow=s7 SPURIOUS: hasTaintFlow=s8
63+
sink(s.splice(source("s7"), 1, 2, "str")); // $ hasTaintFlow=s7
6464
sink(s.splice("str", 1, 2, source("s8"))); // $ hasTaintFlow=s8
6565

6666
sink(s.prune(source("s9"), 1, "additional")); // $ hasTaintFlow=s9

0 commit comments

Comments
 (0)