Skip to content

Commit ff74fe1

Browse files
committed
rename hasChildThatMatchesIgnoringCasing to hasChildThatMatchesIgnoringCasingFlags
1 parent 75a3f34 commit ff74fe1

File tree

1 file changed

+5
-10
lines changed
  • javascript/ql/lib/semmle/javascript/security/performance

1 file changed

+5
-10
lines changed

javascript/ql/lib/semmle/javascript/security/performance/ReDoSUtil.qll

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,7 @@ private predicate isCanonicalTerm(RelevantRegExpTerm term, string str) {
186186
*/
187187
string getCanonicalizationFlags(RegExpTerm root) {
188188
root.isRootTerm() and
189-
(
190-
if RegExpFlags::isIgnoreCase(root) then
191-
result = "i"
192-
else
193-
result = ""
194-
)
189+
(if RegExpFlags::isIgnoreCase(root) then result = "i" else result = "")
195190
}
196191

197192
/**
@@ -324,16 +319,16 @@ private module CharacterClasses {
324319
if RegExpFlags::isIgnoreCase(cc.getRootTerm())
325320
then
326321
// normalize everything to lower case if the regexp is case insensitive
327-
exists(string c | hasChildThatMatchesIgnoringCasing(cc, c) | char = c.toLowerCase())
328-
else hasChildThatMatchesIgnoringCasing(cc, char)
322+
exists(string c | hasChildThatMatchesIgnoringCasingFlags(cc, c) | char = c.toLowerCase())
323+
else hasChildThatMatchesIgnoringCasingFlags(cc, char)
329324
}
330325

331326
/**
332327
* Holds if the character class `cc` has a child (constant or range) that matches `char`.
333-
* Ignores whether the character class is inside a regular expression that ignores casing.
328+
* Ignores whether the character class is inside a regular expression that has the ignore case flag.
334329
*/
335330
pragma[noinline]
336-
predicate hasChildThatMatchesIgnoringCasing(RegExpCharacterClass cc, string char) {
331+
predicate hasChildThatMatchesIgnoringCasingFlags(RegExpCharacterClass cc, string char) {
337332
exists(getCanonicalCharClass(cc)) and
338333
exists(RegExpTerm child | child = cc.getAChild() |
339334
char = child.(RegexpCharacterConstant).getValue()

0 commit comments

Comments
 (0)