Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d9ebb7b

Browse files
committed
escape tabs
1 parent bcb2f27 commit d9ebb7b

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

javascript/ql/src/Performance/ReDoS.ql

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,12 @@ State process(State fork, string w, int i) {
996996
*/
997997
bindingset[s]
998998
string escape(string s) {
999-
result = s.replaceAll("\\", "\\\\").replaceAll("\n", "\\n").replaceAll("\r", "\\r")
999+
result =
1000+
s
1001+
.replaceAll("\\", "\\\\")
1002+
.replaceAll("\n", "\\n")
1003+
.replaceAll("\r", "\\r")
1004+
.replaceAll("\t", "\\t")
10001005
}
10011006

10021007
/**

javascript/ql/test/query-tests/Performance/ReDoS/ReDoS.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
| tst.js:52:70:52:72 | .*? | This part of the regular expression may cause exponential backtracking on strings starting with '$.$[' and containing many repetitions of ']['. |
6464
| tst.js:58:15:58:20 | [a-z]+ | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of 'a'. |
6565
| tst.js:60:43:60:54 | [a-zA-Z0-9]+ | This part of the regular expression may cause exponential backtracking on strings starting with '0' and containing many repetitions of '0'. |
66-
| tst.js:66:16:66:31 | [\\w#:.~>+()\\s-]+ | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of '\t'. |
66+
| tst.js:66:16:66:31 | [\\w#:.~>+()\\s-]+ | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of '\\t'. |
6767
| tst.js:66:38:66:40 | .*? | This part of the regular expression may cause exponential backtracking on strings starting with '[' and containing many repetitions of ']['. |
6868
| tst.js:71:19:71:26 | (\\\\?.)*? | This part of the regular expression may cause exponential backtracking on strings starting with '"' and containing many repetitions of '\\\\a'. |
6969
| tst.js:74:14:74:21 | (b\|a?b)* | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of 'b'. |

0 commit comments

Comments
 (0)