milkshakesoftware/PreMailer.Net

Regex in CssParser never ends and uses 100% cpu.

mikemakos opened this issue · 1 comments

Using the css style from this url:
https://assets1-production.mightynetworks.com/assets/mb_mailer_main-6b7073985319ef7f1b2ff77ccc50d90e87e094b4d59d59e9bd335987c5edcad3.css

makes the method CleanUp inside CssParser to never finish and uses 100% of the CPU.
The problem is in CssCommentRegex.Replace in line 113.
I am not good with Regex, so either look at why the Regex stucks in an endless back tracking loop or
add a Regex.MatchTimeout property to end the processing.

Thanks

Maybe it could be related with #290