NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/40422: struct tm cannot represent full range of 64-bit time_t, breaks mktime(3)



>Number:         40422
>Category:       lib
>Synopsis:       struct tm cannot represent full range of 64-bit time_t, breaks 
>mktime(3)
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 17 14:50:00 +0000 2009
>Originator:     Tobias Nygren
>Release:        5.99.7
>Organization:
>Environment:
>Description:
"struct tm" cannot represent the full range of times supported by 64-bit
time_t, due to overflow in tm.tm_year around time_t = (1<<57) or so.

Certain libc 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 correctly.

This also means mktime(3) is currently broken for all valid input arguments 
because of internal conversion of very large values of time_t to struct tm in 
time2sub().

>How-To-Repeat:
date +%s

>Fix:
Add appropriate range checks.



Home | Main Index | Thread Index | Old Index