Skip to content

Commit 05939bd

Browse files
committed
Swift: Add a test case for \Uhhhhhhhh character escapes.
1 parent 9b9b4a1 commit 05939bd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

swift/ql/test/library-tests/regex/redos_variants.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,13 @@ func myRegexpVariantsTests(myUrl: URL) throws {
500500
// GOOD
501501
_ = try Regex(#"X(\u0061|b)+Y"#).firstMatch(in: tainted)
502502

503+
// BAD
504+
// attack string: "X" + "a" x lots
505+
_ = try Regex(#"X(\U00000061|a)*Y"#).firstMatch(in: tainted) // $ MISSING: redos-vulnerable=
506+
507+
// GOOD
508+
_ = try Regex(#"X(\U00000061|b)+Y"#).firstMatch(in: tainted)
509+
503510
// BAD TODO: we should get this one
504511
// attack string: "X" + "a" x lots
505512
_ = try Regex(#"X(\x61|a)*Y"#).firstMatch(in: tainted) // $ MISSING: redos-vulnerable=

0 commit comments

Comments
 (0)