This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #123495] Stop gmtime(nan) from crashing
authorFather Chrysostomos <sprout@cpan.org>
Thu, 25 Dec 2014 17:57:07 +0000 (09:57 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 25 Dec 2014 18:06:50 +0000 (10:06 -0800)
commitd8bd3d828a02f8df716063d9980b8b9af539ca42
tree2ab8f172d8effdfc6bfe884daed9992408fb72e1
parent19bf1007743b4337230ad3a4538df4bd94311fc4
[perl #123495] Stop gmtime(nan) from crashing

We were getting a time struct like this:

$12 = {
  tm_sec = -2147483588,
  tm_min = 2147483647,
  tm_hour = -2147483624,
  tm_mday = -2147483647,
  tm_mon = 11,
  tm_year = 69,
  tm_wday = -2147483641,
  tm_yday = -2147483314,
  tm_isdst = 0,
  tm_gmtoff = 0,
  tm_zone = 0x1004f6bb6 "UTC"
}

which resulted in dayname[tmbuf.tm_wday] reading past the beginning
of the array.  We should check for nan explicitly instead of falling
through to the time calculations.
pp_sys.c
t/lib/warnings/pp_sys
t/op/time.t