Issue #13169: The maximal repetition number in a regular expression has been

increased from 65534 to 2147483647 (on 32-bit platform) or 4294967294 (on
64-bit).
This commit is contained in:
Serhiy Storchaka 2013-02-16 16:47:47 +02:00
parent b19ed57d8d
commit 70ca0210e8
7 changed files with 62 additions and 13 deletions

View file

@ -15,6 +15,7 @@
import sys
from sre_constants import *
from _sre import MAXREPEAT
SPECIAL_CHARS = ".\\[{()*+?^$|"
REPEAT_CHARS = "*+?{"
@ -505,10 +506,14 @@ def _parse(source, state):
continue
if lo:
min = int(lo)
if min >= MAXREPEAT:
raise OverflowError("the repetition number is too large")
if hi:
max = int(hi)
if max < min:
raise error("bad repeat interval")
if max >= MAXREPEAT:
raise OverflowError("the repetition number is too large")
if max < min:
raise error("bad repeat interval")
else:
raise error("not supported")
# figure out which item to repeat