#17100: Possible bad regex for email validator
-------------------------------+--------------------
     Reporter:  reames@…       |      Owner:  nobody
         Type:  Uncategorized  |     Status:  new
    Component:  Core (Other)   |    Version:  1.3
     Severity:  Normal         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------
 Around line 150 of /django/core/validators.py is a line in which I think
 there's a missing backslash:
 {{{
 
r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-011\013\014\016-\177])*"'
 # quoted-string
                                 missing backslash? ----^
 }}}

 If you look at the debug output of that part of the regex, I think the
 backslash is what is meant.
 {{{
 >>> re.compile(r'[\001-\011]', re.DEBUG)
 in
   range (1, 9)
 <_sre.SRE_Pattern object at 0x137e9b0>
 >>> re.compile(r'[\001-011]', re.DEBUG)
 in
   range (1, 48)
   literal 49
   literal 49
 <_sre.SRE_Pattern object at 0x137ea48>
 }}}

 Given this, the following email should fail: "\12"@example.com

 A test case:
 {{{assert(email_re.match('"\\\12"@example.com') == None)}}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17100>
Django <https://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.

Reply via email to