Is passing text directly from user to `java.util.regex.Pattern` safe? -
is passing user input directly java.util.regex.pattern
later used java.util.regex.matcher
safe?
if not, why? create infinite loop or exponential calculation? if so, other options?
regexp
never safe. personally, refrain using them if don't have to. can construct regexp take ages checked or ever crash system.
some additional reading can found here: http://www.regular-expressions.info/catastrophic.html
i can't think of use-case justify letting user pass regex server.
wiki
Comments
Post a Comment