5992: Crash when using a not allowed string as regex in Person with name filter

svn: r20368
This commit is contained in:
Benny Malengier 2012-09-11 11:54:50 +00:00
parent 55af9b7ce3
commit e020136c73
2 changed files with 32 additions and 27 deletions

View File

@ -95,6 +95,7 @@ class HasNameOf(Rule):
if not self.patr:
valpatr = 1
if self.regular_expression:
try:
if self.firstn and not re.match(self.firstn, name.get_first_name(), re.I|re.U|re.L):
val = 0
elif self.lastn and not re.match(self.lastn, name.get_surname(), re.I|re.U|re.L):
@ -121,6 +122,9 @@ class HasNameOf(Rule):
if self.patr and surn.get_origintype().value == NameOriginType.PATRONYMIC \
and re.match(self.patr, surn.get_surname(), re.I|re.U|re.L):
valpatr = 1
except re.error:
#indicate error in the pattern by matching everyone
return True
else:
if self.firstn and name.get_first_name().upper().find(self.firstn) == -1:
val = 0

View File

@ -54,7 +54,8 @@ class RegExpName(Rule):
try:
self.match = re.compile(list[0],re.I|re.U|re.L)
except:
except re.error:
#indicate error by matching everyone
self.match = re.compile('')
def apply(self,db,person):