Skip to content

Commit d6c76aa

Browse files
authored
Fix cpp/redos test: swap non-exponential (a|ab)* for (a*)* and populate expected
1 parent 47969ae commit d6c76aa

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
| test.cpp:58:26:58:27 | a+ | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of 'a'. |
2+
| test.cpp:64:25:64:30 | (a\|a)* | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of 'a'. |
3+
| test.cpp:70:26:70:27 | a* | This part of the regular expression may cause exponential backtracking on strings containing many repetitions of 'a'. |

‎cpp/ql/test/query-tests/Security/CWE/CWE-1333-ReDoS/test.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void test_exp_redos(const std::string& input) {
6767

6868
// BAD: alternation with overlapping branches inside a repetition.
6969
{
70-
std::regex re("^(a|ab)*$");
70+
std::regex re("^(a*)*$");
7171
std::regex_match(input, re);
7272
}
7373

0 commit comments

Comments
 (0)