Segfault in 64-bit tai64nlocal

Jeremy Fishman <[email protected]> Wed, 7 Nov 2012 14:52:41 -0800
Newsgroups gmane.comp.djb.syslog
Message-ID <CAD7zAcs--iyq1cq2-muBHMA6KTPR4rUUN8SRG0bwcTFwRk49tw@mail.gmail.com>
--20cf303dd33e76017e04cdef9388
Content-Type: text/plain; charset="UTF-8"

Hello loggers,

There is a trivial segfault in tai64nlocal when compiled for x86_64 and
passed an invalid TAI timestamp.

time_t secs;
...
      secs -= 4611686018427387914ULL;
      t = localtime(&secs);
      out(num,fmt_ulong(num,1900 + t->tm_year));
      ...


The code assumes that localtime(3) will not return NULL, which it may in
case of EOVERFLOW in POSIX.1-2001.

Is this something that might get fixed upstream, or should I file against
distributions?  I have verified Ubuntu, Debian, and CentOS on x86_64 have
this issue.

  - Jeremy

--20cf303dd33e76017e04cdef9388
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hello loggers,<div><br></div><div>There is a trivial segfault in tai64nloca=
l when compiled for x86_64 and passed an invalid TAI timestamp.</div><div><=
br></div><div><blockquote style=3D"margin:0 0 0 40px;border:none;padding:0p=
x">


<div><div><font face=3D"courier new, monospace">time_t secs;</font></div></=
div><div><font face=3D"courier new, monospace">...</font></div><div><div><f=
ont face=3D"courier new, monospace">=C2=A0 =C2=A0 =C2=A0 secs -=3D 46116860=
18427387914ULL;</font></div>


<div><font face=3D"courier new, monospace">=C2=A0 =C2=A0 =C2=A0 t =3D local=
time(&amp;secs);</font></div></div><div><font face=3D"courier new, monospac=
e">=C2=A0 =C2=A0 =C2=A0 out(num,fmt_ulong(num,1900 + t-&gt;tm_year));</font=
></div><div><font face=3D"courier new, monospace">=C2=A0 =C2=A0 =C2=A0 ...<=
/font></div>


</blockquote><br></div><div>The code assumes that localtime(3) will not ret=
urn NULL, which it may in case of EOVERFLOW in POSIX.1-2001.</div><div><br>=
</div><div>Is this something that might get fixed upstream, or should I fil=
e against distributions? =C2=A0I have verified Ubuntu, Debian, and CentOS o=
n x86_64 have this issue.</div>
<div><br></div><div>=C2=A0 - Jeremy</div><div><br></div>

--20cf303dd33e76017e04cdef9388--