File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed
swift/ql/src/queries/Security/CWE-1333 Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change 22<qhelp >
33 <include src =" ReDoSIntroduction.inc.qhelp" />
44 <example >
5- <p >Consider this regular expression:</p >
5+ <p >Consider the following regular expression:</p >
66 <sample language =" swift" >
77/^_(__|.)+_$/</sample >
88 <p >
99 Its sub-expression <code >"(__|.)+"</code > can match the string
1010 <code >"__"</code > either by the first alternative <code >"__"</code > to the
1111 left of the <code >"|"</code > operator, or by two repetitions of the second
12- alternative <code >"."</code > to the right. Thus , a string consisting of an
12+ alternative <code >"."</code > to the right. Therefore , a string consisting of an
1313 odd number of underscores followed by some other character will cause the
1414 regular expression engine to run for an exponential amount of time before
1515 rejecting the input.
Original file line number Diff line number Diff line change 3131 <p >
3232 Modify the regular expression to remove the ambiguity, or ensure that the
3333 strings matched with the regular expression are short enough that the
34- time- complexity does not matter.
34+ time complexity does not matter.
3535 </p >
3636 </recommendation >
3737</qhelp >
You can’t perform that action at this time.
0 commit comments