Mitigation:
Fixes have already been released. These include adding limit checks for the effective size of repeated text as well as the length of a regular expression supplied to the matches operator.
Users of affected versions should upgrade to a new version that contains the fixes:
6.0.x users should upgrade to 6.0.7+. 5.3.x users should upgrade to 5.3.26+. 5.2.x users should upgrade to 5.2.23.RELEASE+.