5992: Crash when using a not allowed string as regex in Person with name filter
svn: r20368
This commit is contained in:
parent
55af9b7ce3
commit
e020136c73
@ -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
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user