diff --git a/javascript/ql/lib/semmle/javascript/Regexp.qll b/javascript/ql/lib/semmle/javascript/Regexp.qll index 27ad339c733..a06b73e9530 100644 --- a/javascript/ql/lib/semmle/javascript/Regexp.qll +++ b/javascript/ql/lib/semmle/javascript/Regexp.qll @@ -972,7 +972,7 @@ private predicate isUsedAsNumber(DataFlow::LocalSourceNode value) { or exists(DataFlow::CallNode call | call.getCalleeName() = - ["substring", "substr", "slice", "splice", "charAt", "charCodeAt", "codePointAt"] and + ["substring", "substr", "slice", "splice", "charAt", "charCodeAt", "codePointAt", "toSpliced"] and value.flowsTo(call.getAnArgument()) ) } diff --git a/javascript/ql/test/library-tests/RegExp/IsRegex/IsRegex.expected b/javascript/ql/test/library-tests/RegExp/IsRegex/IsRegex.expected index a79282e2c96..0fb07c050d4 100644 --- a/javascript/ql/test/library-tests/RegExp/IsRegex/IsRegex.expected +++ b/javascript/ql/test/library-tests/RegExp/IsRegex/IsRegex.expected @@ -1,2 +1,3 @@ | tst.js:1:12:1:38 | '^http: ... le.com' | is a regular expression | | tst.js:4:37:4:43 | 'regex' | is a regular expression | +| tst.js:9:37:9:43 | 'regex' | is a regular expression | diff --git a/javascript/ql/test/library-tests/RegExp/IsRegex/tst.js b/javascript/ql/test/library-tests/RegExp/IsRegex/tst.js index a8035cb3fc3..3776821f785 100644 --- a/javascript/ql/test/library-tests/RegExp/IsRegex/tst.js +++ b/javascript/ql/test/library-tests/RegExp/IsRegex/tst.js @@ -6,6 +6,6 @@ function detectRegexViaSplice(string) { }; function detectRegexViaToSpliced(string) { - let found = getMyThing().search('regex'); // NOT OK -- Should be marked as regular expression but it is not. + let found = getMyThing().search('regex'); // NOT OK arr.toSpliced(found, 1); };