Skip to content

Commit b333f52

Browse files
committed
JS: Fix: now one can determine regex via Array.prototype.toSpliced function call.
1 parent 2b0def1 commit b333f52

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

javascript/ql/lib/semmle/javascript/Regexp.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ private predicate isUsedAsNumber(DataFlow::LocalSourceNode value) {
972972
or
973973
exists(DataFlow::CallNode call |
974974
call.getCalleeName() =
975-
["substring", "substr", "slice", "splice", "charAt", "charCodeAt", "codePointAt"] and
975+
["substring", "substr", "slice", "splice", "charAt", "charCodeAt", "codePointAt", "toSpliced"] and
976976
value.flowsTo(call.getAnArgument())
977977
)
978978
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
| tst.js:1:12:1:38 | '^http: ... le.com' | is a regular expression |
22
| tst.js:4:37:4:43 | 'regex' | is a regular expression |
3+
| tst.js:9:37:9:43 | 'regex' | is a regular expression |

javascript/ql/test/library-tests/RegExp/IsRegex/tst.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ function detectRegexViaSplice(string) {
66
};
77

88
function detectRegexViaToSpliced(string) {
9-
let found = getMyThing().search('regex'); // NOT OK -- Should be marked as regular expression but it is not.
9+
let found = getMyThing().search('regex'); // NOT OK
1010
arr.toSpliced(found, 1);
1111
};

0 commit comments

Comments
 (0)