Author rushing
Recipients
Date 2004-11-12.20:46:23
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
sre_parse.py includes a check to ensure that the
hard-coded limit of 100 groups is not exceeded.
Since the check uses an assert(), it's not present
when running in '-O' mode, so you can easily segfault
the re engine:

rushing@fang:~$ /usr/local/bin/python -O
Python 2.3.4 (#2, Oct 23 2004, 05:24:36) 
[GCC 3.4.2 [FreeBSD] 20040728] on freebsd5
>>> import re
>>> p = re.compile ('(' + '|'.join (['(xxx)']*200) + ')')
>>> p.search ('asdfasdfasdfasdfasdf')
Segmentation fault (core dumped)

The assert() should be changed to an 'if/raise'.

NOTE: I've sent changes to Frederik to remove the
limitation altogether - so if those get in before this
bug is addressed then please ignore.
History
Date User Action Args
2007-08-23 14:27:25adminlinkissue1065427 messages
2007-08-23 14:27:25admincreate