Skip to content

Commit 0cc19d9

Browse files
committed
use toUnicode in ReDoSUtil.qll
1 parent 039b655 commit 0cc19d9

File tree

2 files changed

+2
-12
lines changed
  • javascript/ql/lib/semmle/javascript/security/performance
  • python/ql/lib/semmle/python/security/performance

2 files changed

+2
-12
lines changed

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -422,12 +422,7 @@ private module CharacterClasses {
422422
char = "0123456789".charAt(_)
423423
or
424424
clazz = "s" and
425-
(
426-
char = [" ", "\t", "\r", "\n"]
427-
or
428-
char = getARelevantChar() and
429-
char.regexpMatch("\\u000b|\\u000c") // \v|\f (vertical tab | form feed)
430-
)
425+
char = [" ", "\t", "\r", "\n", 11.toUnicode(), 12.toUnicode()] // 11.toUnicode() = \v, 12.toUnicode() = \f
431426
or
432427
clazz = "w" and
433428
char = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_".charAt(_)

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -422,12 +422,7 @@ private module CharacterClasses {
422422
char = "0123456789".charAt(_)
423423
or
424424
clazz = "s" and
425-
(
426-
char = [" ", "\t", "\r", "\n"]
427-
or
428-
char = getARelevantChar() and
429-
char.regexpMatch("\\u000b|\\u000c") // \v|\f (vertical tab | form feed)
430-
)
425+
char = [" ", "\t", "\r", "\n", 11.toUnicode(), 12.toUnicode()] // 11.toUnicode() = \v, 12.toUnicode() = \f
431426
or
432427
clazz = "w" and
433428
char = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_".charAt(_)

0 commit comments

Comments
 (0)