From: Tim Bunce Date: Fri, 5 Sep 1997 00:00:00 +0000 (+0000) Subject: Trap Time::Local infinite loop X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=390badbd978a6d3c3c123238f50606236d652edd;p=p5sagit%2Fp5-mst-13.2.git Trap Time::Local infinite loop (this is the same change as commit 160771401404fad17bea1cbac474c73580214f79, but as applied) --- diff --git a/lib/Time/Local.pm b/lib/Time/Local.pm index d2d70da..eef412d 100644 --- a/lib/Time/Local.pm +++ b/lib/Time/Local.pm @@ -107,7 +107,9 @@ sub cheat { @g = gmtime($guess); $year += $YearFix if $year < $epoch; $lastguess = ""; + $counter = 0; while ($diff = $year - $g[5]) { + croak "Can't handle date (".join(", ",@_).")" if ++$counter > 255; $guess += $diff * (363 * $DAY); @g = gmtime($guess); if (($thisguess = "@g") eq $lastguess){ @@ -116,6 +118,7 @@ sub cheat { $lastguess = $thisguess; } while ($diff = $month - $g[4]) { + croak "Can't handle date (".join(", ",@_).")" if ++$counter > 255; $guess += $diff * (27 * $DAY); @g = gmtime($guess); if (($thisguess = "@g") eq $lastguess){