#11198: Forms URLfield regex takes infinite to validate a long field
------------------------------------+---------------------------------------
Reporter: marcob | Owner: nobody
Status: reopened | Milestone:
Component: Uncategorized | Version: SVN
Resolution: | Keywords:
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
------------------------------------+---------------------------------------
Comment (by dc):
Python regex engine works as expected, this is a Django bug. Or more
specifically an url_re bug - it leads to the [http://www.regular-
expressions.info/catastrophic.html catastrophic backtracking] and takes
around 208910 steps (according to the !RegexBuddy) to complete.
If you will change this line in url_re:
{{{
r'(?:(?:[A-Z0-9]+(?:-*[A-Z0-9]+)*\.)+[A-Z]{2,6}|' #domain...
}}}
to this:
{{{
r'(?:(?:[A-Z0-9](?:-*[A-Z0-9]+)*\.)+[A-Z]{2,6}|' #domain...
}}}
it will work as before in normal cases, but in edge cases it will complete
much quicker (around 71 step, for the given url)
--
Ticket URL: <http://code.djangoproject.com/ticket/11198#comment:4>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---