NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lib/40422: struct tm cannot represent full range of 64-bit time_t,breaks mktime(3)
The following reply was made to PR lib/40422; it has been noted by GNATS.
From: Matthias Drochner <M.Drochner%fz-juelich.de@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: lib-bug-people%NetBSD.org@localhost, gnats-admin%NetBSD.org@localhost,
netbsd-bugs%NetBSD.org@localhost
Subject: Re: lib/40422: struct tm cannot represent full range of 64-bit
time_t,breaks mktime(3)
Date: Mon, 19 Jan 2009 12:41:10 +0100
Sorry, I was abroad and didn't read list mail, otherwise
I'd have mentioned your PR in the commit msg.
(and it would have saved me some time to identify the
function in localtime.c where the overflow happens)
tnn%NetBSD.org@localhost said:
> functions like localtime(3) need to be aware of this and should return
> NULL and set errno appropriately if the time is too large to be
> represented
Yes, but with the current localtime.c the change looks invasive.
(As I understand it the overflow happens in timesub() which
has no return value.)
Just had a look at tzcode2008h - timesub() can return an error,
and it seems to do the right check.
So I think the way to go is to update the code to the
current tzcode release (which is 2008h or the upcoming
2009a - see Robert Elz's mail to tech-userlevel).
localtime.c rev. 1.43 should fix the problem for
applications as long as they use "reasonable" time_t
values. (Could you test with your testcases?)
I'd suggest to defer the additional localtime()
etc checks until tzcode is updated.
best regards
Matthias
-------------------------------------------------------------------
-------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Baerbel Brumme-Bothe
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr. Harald Bolt,
Dr. Sebastian M. Schmidt
-------------------------------------------------------------------
-------------------------------------------------------------------
Home |
Main Index |
Thread Index |
Old Index