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

Skip to content

Commit 2f4fcc2

Browse files
erik-kroghasgerf
andauthored
Apply suggestions from code review
Co-authored-by: Asger F <[email protected]>
1 parent 3ef5d89 commit 2f4fcc2

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

javascript/ql/src/Performance/ReDoS.ql

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ private predicate sharesRoot(TInputSymbol a, TInputSymbol b) {
169169
}
170170

171171
/**
172-
* Holds if the `a` is an inputsymbol from a regexp that has root `root`.
172+
* Holds if the `a` is an input symbol from a regexp that has root `root`.
173173
*/
174174
private predicate belongsTo(TInputSymbol a, RegExpRoot root) {
175175
exists(RegExpTerm term | getRoot(term) = root |
@@ -201,9 +201,15 @@ class InputSymbol extends TInputSymbol {
201201
*/
202202
abstract class CharacterClass extends InputSymbol {
203203
/**
204-
* Gets a char that is likely relevant for the ReDoS analysis of this character class.
205-
* That is: One of the endpoints to the character class,
206-
* or a char that is off-by-one to one of the endpoints of the character class (if this is an inversed character class).
204+
* Gets a character that is relevant for intersection-tests involving this
205+
* character class.
206+
*
207+
* Specifically, this is any of the characters mentioned explicitly in the
208+
* character class, offset by one if it is inverted. For character class escapes,
209+
* the result is as if the class had been written out as a series of intervals.
210+
*
211+
* This set is large enough to ensure that for any two intersecting character
212+
* classes, one contains a relevant character from the other.
207213
*/
208214
abstract string getARelevantChar();
209215

0 commit comments

Comments
 (0)