[Python-Dev] (s)re crashing in regrtest (was SRE 0.9.8 benchmarks)

Mark Favas m.favas@per.dem.csiro.au
Thu, 03 Aug 2000 19:35:48 +0800


Fredrik Lundh wrote:
> 
> mark favas wrote:
> > In fact, on my machine with the default stacksize of 2048kb, test_re.py
> > already exercises this bug.> 
> afaik, there was no test in the standard test suite that
> included run-away recursion...
> 
> what test is causing this error?
> 
> (adding a print statement to sre._compile should help you
> figure that out...)
> 
> </F>

The stack overflow is caused by the test (in test_re.py):

# Try nasty case that overflows the straightforward recursive
# implementation of repeated groups.
assert re.match('(x)*', 50000*'x').span() == (0, 50000)

(changing 50000 to 18000 works, 19000 overflows...)

-- 
Email  - m.favas@per.dem.csiro.au        Mark C Favas
Phone  - +61 8 9333 6268, 0418 926 074   CSIRO Exploration & Mining
Fax    - +61 8 9383 9891                 Private Bag No 5, Wembley
WGS84  - 31.95 S, 115.80 E               Western Australia 6913