From 1f25b5393b0e3ec26d1a97429563944eb15edc30 Mon Sep 17 00:00:00 2001 From: John Goerzen Date: Wed, 24 Aug 2005 19:01:42 +0100 Subject: [PATCH] [324827] Fixed handling of invalid dates Patch from Nikita V. Youshchenko From: "Nikita V. Youshchenko" To: Debian Bug Tracking System Subject: offlineimap: exception on mail with broken headers (+fix) Date: Wed, 24 Aug 2005 13:41:08 +0400 Package: offlineimap Version: 4.0.10 Severity: normal Tags: patch Recently I've got an exception (see below) while using offlineimap. Exception was probably caused by invalid Date header of (likely spam) message: Date: Sat, 20 Aug 2005 4294967295:43:18 -0700 --- offlineimap/folder/IMAP.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py index 93f83f4..3ad5b13 100644 --- a/offlineimap/folder/IMAP.py +++ b/offlineimap/folder/IMAP.py @@ -199,7 +199,7 @@ class IMAPFolder(BaseFolder): raise ValueError # This could raise a value error if it's not a valid format. date = imaplib.Time2Internaldate(datetuple) - except ValueError: + except (ValueError, OverflowError): # Argh, sometimes it's a valid format but year is 0102 # or something. Argh. It seems that Time2Internaldate # will rause a ValueError if the year is 0102 but not 1902, -- 2.39.2