SidneyShaw / simple-java-mail

Automatically exported from code.google.com/p/simple-java-mail
0 stars 0 forks source link

Catastrophic backtracking in validation regexes #3

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
There are some email addresses that behave *very* poorly with the validation 
done in EmailValidationUtil.  I think it might be due to the nested quantifiers 
in the complex regexes there.  They literally take hours to finish the 
validation, using 100% CPU.

Is there any way to fix this, and barring that, can an option be added to skip 
validation?

To reproduce:
1. Try to send an email to an address like 
309d4696df38ff12c023600e3bc2bd4b@fakedomain.com
2. Wait for computer to explode

(Using java 1.6.0_31)

Original issue reported on code.google.com by semico...@gmail.com on 20 Apr 2012 at 10:13

GoogleCodeExporter commented 9 years ago

Original comment by b.bottema on 9 May 2012 at 8:44

GoogleCodeExporter commented 9 years ago
The regex expressions come from another open source project, 
http://code.google.com/p/emailaddress/source/browse/.

The problem is that the class has exploded over there so I would have to patch 
our own version. Alas, regular expressions is not my specialty. Any thoughts on 
how to fix this?

Original comment by b.bottema on 9 Aug 2012 at 7:36