[Patches] [ python-Patches-1018386 ] fix for several sre escaping bugs (fixes #776311)

SourceForge.net noreply at sourceforge.net
Fri Sep 3 22:00:52 CEST 2004


Patches item #1018386, was opened at 2004-08-28 19:19
Message generated for change (Comment added) made by mkc
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1018386&group_id=5470

Category: Library (Lib)
Group: Python 2.4
Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: Mike Coleman (mkc)
Assigned to: Gustavo Niemeyer (niemeyer)
Summary: fix for several sre escaping bugs (fixes #776311)

Initial Comment:
This patch fixes a number of escaping bugs in sre (the
re module).  The most serious is an infinite loop in
the parser, which is what the submitter of bug #776311
was seeing.  Another allows octal escapes to have an
arbitrary number of digits--the doc didn't quite
exclude this, but it's clearly the wrong thing (cf.
string literals).  There are others--see the test cases.

----------------------------------------------------------------------

>Comment By: Mike Coleman (mkc)
Date: 2004-09-03 15:00

Message:
Logged In: YES 
user_id=555

Gustavo, it looks better than my patch.

Two very minor comments:
- The s/wildcare/wildcard/ fix to _sre.c got dropped?
- In this expression, you're checking the first digit, then
the third, then the second.  I'd check them in order, for
readability.

       c in OCTDIGITS and s.next in OCTDIGITS and this[2] in
OCTDIGITS

As I said, very minor.  Thanks for the quick review/apply!


----------------------------------------------------------------------

Comment By: Gustavo Niemeyer (niemeyer)
Date: 2004-09-03 12:18

Message:
Logged In: YES 
user_id=7887

Applied as: 
 
Lib/sre_parse.py: 1.62 
Lib/test/test_re.py: 1.51 
Doc/lib/libre.tex: 1.109 
 
It was a little bit modified to adapt to the current CVS version. 
 
I've also reimplemented the logic of numeric escaping with a logic 
similar to what is used in _escape() function, making it a little bit 
faster and removing the need for the external function. 
 
I'm attaching the applied patch for reference. Please, let me know if 
you have any comments. 
 
Thanks a lot for the patch! 
 

----------------------------------------------------------------------

Comment By: Gustavo Niemeyer (niemeyer)
Date: 2004-09-02 16:51

Message:
Logged In: YES 
user_id=7887

Of course! I'll be reviewing it offline and get back shortly. 
 
Thanks for assigning it to me! 

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2004-08-29 11:01

Message:
Logged In: YES 
user_id=21627

Gustavo, can you take a look? If not, please unassign.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1018386&group_id=5470


More information about the Patches mailing list