Skip to content

Commit 7b204ce

Browse files
authored
Merge pull request github#6551 from erik-krogh/redosUnicode
JS/Python: use toUnicode in ReDoSUtil.qll
2 parents 039b655 + 0cc19d9 commit 7b204ce

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)