Skip to content

Commit 8535e6f

Browse files
committed
use toUnicode in RegexTreeView
1 parent 4adb0c7 commit 8535e6f

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

python/ql/lib/semmle/python/RegexTreeView.qll

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,9 +458,10 @@ class RegExpEscape extends RegExpNormalChar {
458458
or
459459
this.getUnescaped() = "t" and result = "\t"
460460
or
461-
// TODO: Find a way to include a formfeed character
462-
// this.getUnescaped() = "f" and result = " "
463-
// or
461+
this.getUnescaped() = "f" and result = 12.toUnicode()
462+
or
463+
this.getUnescaped() = "v" and result = 11.toUnicode()
464+
or
464465
isUnicode() and
465466
result = getUnicode()
466467
}

python/ql/test/query-tests/Security/CWE-730-ReDoS/ReDoS.expected

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
| redos.py:139:25:139:31 | (\\w\|G)* | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of 'G'. |
3636
| redos.py:145:25:145:32 | (\\d\|\\w)* | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of '0'. |
3737
| redos.py:148:25:148:31 | (\\d\|5)* | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of '5'. |
38+
| redos.py:151:25:151:34 | (\\s\|[\\f])* | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of '\u000c'. |
39+
| redos.py:154:25:154:38 | (\\s\|[\\v]\|\\\\v)* | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of '\u000b'. |
40+
| redos.py:157:25:157:34 | (\\f\|[\\f])* | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of '\u000c'. |
3841
| redos.py:160:25:160:32 | (\\W\|\\D)* | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of ' '. |
3942
| redos.py:163:25:163:32 | (\\S\|\\w)* | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of '0'. |
4043
| redos.py:166:25:166:34 | (\\S\|[\\w])* | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of '0'. |

0 commit comments

Comments
 (0)