mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-10 05:03:06 +03:00
mktime: fix bug with Y2038 DST transition
[BZ#23789] * time/mktime.c (ranged_convert): On 32-bit platforms, don’t mishandle a DST transition that jumps over the Y2038 boundary. No such DST transitions are known so this is only a theoretical bug, but we might as well do things right.
This commit is contained in:
committed by
Albert ARIBAUD (3ADEV)
parent
efbdddc381
commit
f6b3331bba
@@ -1,5 +1,12 @@
|
|||||||
2018-11-15 Paul Eggert <eggert@cs.ucla.edu>
|
2018-11-15 Paul Eggert <eggert@cs.ucla.edu>
|
||||||
|
|
||||||
|
mktime: fix bug with Y2038 DST transition
|
||||||
|
[BZ#23789]
|
||||||
|
* time/mktime.c (ranged_convert): On 32-bit platforms, don’t
|
||||||
|
mishandle a DST transition that jumps over the Y2038 boundary.
|
||||||
|
No such DST transitions are known so this is only a theoretical
|
||||||
|
bug, but we might as well do things right.
|
||||||
|
|
||||||
mktime: make more room for overflow
|
mktime: make more room for overflow
|
||||||
[BZ#23789]
|
[BZ#23789]
|
||||||
* time/mktime.c (long_int): Now 4⨯ int, not just 3⨯.
|
* time/mktime.c (long_int): Now 4⨯ int, not just 3⨯.
|
||||||
|
@@ -323,7 +323,7 @@ ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
|
|||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
long_int mid = long_int_avg (ok, bad);
|
long_int mid = long_int_avg (ok, bad);
|
||||||
if (mid != ok && mid != bad)
|
if (mid == ok || mid == bad)
|
||||||
break;
|
break;
|
||||||
r = convert_time (convert, mid, tp);
|
r = convert_time (convert, mid, tp);
|
||||||
if (r)
|
if (r)
|
||||||
@@ -332,6 +332,8 @@ ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
|
|||||||
bad = mid;
|
bad = mid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*t = ok;
|
||||||
|
|
||||||
if (!r && ok)
|
if (!r && ok)
|
||||||
{
|
{
|
||||||
/* The last conversion attempt failed;
|
/* The last conversion attempt failed;
|
||||||
|
Reference in New Issue
Block a user