You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by fe...@apache.org on 2005/05/20 01:37:10 UTC

svn commit: r171015 - /spamassassin/branches/3.0/lib/Mail/SpamAssassin/Util.pm

Author: felicity
Date: Thu May 19 16:37:09 2005
New Revision: 171015

URL: http://svn.apache.org/viewcvs?rev=171015&view=rev
Log:
bug 4085: avoid 'sec too big' issues with Time::Local v1.10 and later

Modified:
    spamassassin/branches/3.0/lib/Mail/SpamAssassin/Util.pm

Modified: spamassassin/branches/3.0/lib/Mail/SpamAssassin/Util.pm
URL: http://svn.apache.org/viewcvs/spamassassin/branches/3.0/lib/Mail/SpamAssassin/Util.pm?rev=171015&r1=171014&r2=171015&view=diff
==============================================================================
--- spamassassin/branches/3.0/lib/Mail/SpamAssassin/Util.pm (original)
+++ spamassassin/branches/3.0/lib/Mail/SpamAssassin/Util.pm Thu May 19 16:37:09 2005
@@ -387,6 +387,17 @@
 
   $hh ||= 0; $mm ||= 0; $ss ||= 0; $dd ||= 0; $mmm ||= 0; $yyyy ||= 0;
 
+  # Time::Local (v1.10 at least) throws warnings when the dates cause
+  # a 32-bit overflow.  So force a min/max for year.
+  if ($yyyy > 2037) {
+    dbg("util: forcing year to 2037: $date");
+    $yyyy=2037;
+  }
+  elsif ($yyyy < 1970) {
+    dbg("util: forcing year to 1970: $date");
+    $yyyy=1970;
+  }
+
   my $time;
   eval {		# could croak
     $time = timegm($ss, $mm, $hh, $dd, $mmm-1, $yyyy);