Catch two instances of untested regexp matches

They could possibly lead to the problems mentioned in
  https://github.com/OfflineIMAP/offlineimap/issues/6
though there are no sound evidences for this.

Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
This commit is contained in:
Eygene Ryabinkin 2013-08-27 15:57:55 +04:00
parent 69765a3ef0
commit 1ef506655c
2 changed files with 6 additions and 0 deletions

View File

@ -104,6 +104,8 @@ class MaildirFolder(BaseFolder):
oldest_time_utc -= oldest_time_today_seconds
timestampmatch = re_timestampmatch.search(messagename)
if not timestampmatch:
return True
timestampstr = timestampmatch.group()
timestamplong = long(timestampstr)
if(timestamplong < oldest_time_utc):

View File

@ -145,6 +145,10 @@ def imapsplit(imapstring):
elif workstr[0] == '"':
# quoted fragments '"...\"..."'
m = quotere.match(workstr)
if not m:
raise ValueError ("failed to parse "
"quoted component %s " % str(workstr) + \
"while working with %s" % str(imapstring))
retval.append(m.group('quote'))
workstr = m.group('rest')
else: