[ python-Bugs-1072259 ] re module segfaulting in large regular expression

SourceForge.net noreply at sourceforge.net
Thu Dec 2 17:20:48 CET 2004


Bugs item #1072259, was opened at 2004-11-24 03:38
Message generated for change (Comment added) made by niemeyer
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1072259&group_id=5470

Category: Extension Modules
Group: Python 2.4
>Status: Closed
>Resolution: Fixed
Priority: 6
Submitted By: Erik Demaine (edemaine)
Assigned to: Gustavo Niemeyer (niemeyer)
Summary: re module segfaulting in large regular expression

Initial Comment:
The attached code worked fine in Python 2.3 and prior,
but broke in a recent version of Python 2.4 (I think
between the alpha and beta, but I'm not sure).  It now
causes a Segmentation fault, at least on my Linux boxes
(2.4.18 and 2.4.22).

For those not looking at the attachment, the code is
essentially:
import re
re.match (...big regular expression..., 'December 20,
1997', re.IGNORECASE)

The code works if the re.IGNORECASE flag is omitted.
I hope I'm not doing anything stupid in installation...
I tried both CVS head and 2.4c1, both with-pyalloc and
without-pyalloc.

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

>Comment By: Gustavo Niemeyer (niemeyer)
Date: 2004-12-02 16:20

Message:
Logged In: YES 
user_id=7887

I'm really sorry for not fixing this before 2.4 final. The only reason 
it wasn't fixed is because I wasn't aware about it until yesterday. 
 
The problem is fixed in CVS on revision 2.110 of _sre.c. The patch is also 
attached for reference. 
 
Thank you very much for reporting it Erik, and thanks you for pointing the 
bug to me Raymond. 
 

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

Comment By: Raymond Hettinger (rhettinger)
Date: 2004-12-01 03:47

Message:
Logged In: YES 
user_id=80475

Verified that this segfaults on Py2.4 final but not Py2.3.



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

Comment By: Erik Demaine (edemaine)
Date: 2004-11-30 23:57

Message:
Logged In: YES 
user_id=265183

FYI, this bug remains in 2.4final, which is a shame to me
(but probably just a timing mishap), as it makes 2.4
unusable to me.

However, the exact version I attached before does seem to
work on on 2.4final on WindowsXP, but still not on Linux. 
Attached is a version that still fails on 2.4final on all
systems I've tried.  The only difference is using
re.compile(...).match instead of re.match.

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

Comment By: Erik Demaine (edemaine)
Date: 2004-11-24 03:40

Message:
Logged In: YES 
user_id=265183

An update: The same code crashes (general protection fault)
on a vanilla install of 2.4c1 on Windows XP using the MSI
installer.  So I don't think it's my installation.

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

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


More information about the Python-bugs-list mailing list