summaryrefslogtreecommitdiff
path: root/lib/Time
diff options
context:
space:
mode:
authorTim Bunce <Tim.Bunce@ig.co.uk>1997-09-05 00:00:00 +0000
committerTim Bunce <Tim.Bunce@ig.co.uk>1997-09-05 00:00:00 +0000
commit390badbd978a6d3c3c123238f50606236d652edd (patch)
treed201b4be49e7e3ddd56532f60189218da7857bfd /lib/Time
parent29d4204f776e15312c0c98f12e65eab4d319cddc (diff)
downloadperl-390badbd978a6d3c3c123238f50606236d652edd.tar.gz
Trap Time::Local infinite loop
(this is the same change as commit 160771401404fad17bea1cbac474c73580214f79, but as applied)
Diffstat (limited to 'lib/Time')
-rw-r--r--lib/Time/Local.pm3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Time/Local.pm b/lib/Time/Local.pm
index d2d70dab20..eef412d46d 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){