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:15 +02:00
parent 94bf697b01
commit e18e05cce9
7 changed files with 68 additions and 15 deletions

View file

@ -15,6 +15,7 @@
import sys
from sre_constants import *
from _sre import MAXREPEAT
SPECIAL_CHARS = ".\\[{()*+?^$|"
REPEAT_CHARS = "*+?{"
@ -498,10 +499,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