Regex DoS (ARCH9135)
هذا المحتوى غير متوفر بلغتك بعد.
Key swift.security.regex-dos · Severity warning · Category security · CWE CWE-1333
Flags regex literals with nested quantifiers ((a+)+, (\w*)*) that backtrack catastrophically.
Incorrect
Section titled “Incorrect”try NSRegularExpression(pattern: "(a+)+$")Correct
Section titled “Correct”try NSRegularExpression(pattern: "a+$")Rewrite without nested quantifiers, or bound the input length.