|
767 | 767 |
|
768 | 768 |
|
769 | 769 |
|
| 770 | +# Check for runaway regex security problem. This will take for-freeking-ever |
| 771 | +# if the security fix isn't in place. |
| 772 | + |
| 773 | +Traceback (most recent call last): |
| 774 | + ... |
| 775 | +ValidationError: [u'Enter a valid e-mail address.'] |
| 776 | +
|
770 | 777 | >>> f = EmailField(required=False)
|
771 | 778 | >>> f.clean('')
|
772 | 779 | u''
|
|
972 | 979 | Traceback (most recent call last):
|
973 | 980 | ...
|
974 | 981 | ValidationError: [u'Enter a valid URL.']
|
| 982 | +>>> f.clean('.') |
| 983 | +Traceback (most recent call last): |
| 984 | +... |
| 985 | +ValidationError: [u'Enter a valid URL.'] |
| 986 | +>>> f.clean('com.') |
| 987 | +Traceback (most recent call last): |
| 988 | +... |
| 989 | +ValidationError: [u'Enter a valid URL.'] |
| 990 | +>>> f.clean('http://example.com.') |
| 991 | +u'http://example.com./' |
| 992 | +>>> f.clean('example.com.') |
| 993 | +u'http://example.com./' |
| 994 | +
|
| 995 | +# hangs "forever" if catastrophic backtracking in ticket:#11198 not fixed |
| 996 | +>>> f.clean('http://%s' % ("X"*200,)) |
| 997 | +Traceback (most recent call last): |
| 998 | +... |
| 999 | +ValidationError: [u'Enter a valid URL.'] |
| 1000 | +
|
| 1001 | +# a second test, to make sure the problem is really addressed, even on |
| 1002 | +# domains that don't fail the domain label length check in the regex |
| 1003 | +>>> f.clean('http://%s' % ("X"*60,)) |
| 1004 | +Traceback (most recent call last): |
| 1005 | +... |
| 1006 | +ValidationError: [u'Enter a valid URL.'] |
| 1007 | +
|
975 | 1008 | >>> f.clean('http://.com')
|
976 | 1009 | Traceback (most recent call last):
|
977 | 1010 | ...
|
|
0 commit comments