smhg / gettext-parser

Parse and compile gettext po and mo files, nothing more, nothing less
MIT License
158 stars 44 forks source link

Avoid catastrophic backtracking #39

Closed smhg closed 6 years ago

smhg commented 6 years ago

The foldLine utility method contains regular expressions which are vulnerable to catastrophic backtracking.

Preferred solution would be to come up with regex which isn't vulnerable as this would be a patch release. But a refactor using String.lastIndexOf() with a smaller list of folding characters (space, dash, dot,...) might be the only valid solution. This would however require it to be a minor release.

Thanks to @davisjam.