Apply upstream commit 943a6621866e9d6e654f5cfe1494378c1fb8957a.
Author: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu Aug 22 12:47:51 2013 -0700
* localtime.c: Fix another integer overflow bug in mktime.
(time2sub): Avoid undefined behavior on time_t overflow.
Reported by Elliott Hughes in
<http://mm.icann.org/pipermail/tz/2013-August/019580.html>.
Bug: 10310929
(cherry picked from commit 713fe6463e)
Change-Id: I9ec79fd8d825e6b9e8bb5af549dbfc2182346c05
This commit is contained in:
@@ -1812,14 +1812,14 @@ time2sub(struct tm * const tmp,
|
||||
} else dir = tmcomp(&mytm, &yourtm);
|
||||
if (dir != 0) {
|
||||
if (t == lo) {
|
||||
++t;
|
||||
if (t <= lo)
|
||||
if (t == time_t_max)
|
||||
return WRONG;
|
||||
++t;
|
||||
++lo;
|
||||
} else if (t == hi) {
|
||||
--t;
|
||||
if (t >= hi)
|
||||
if (t == time_t_min)
|
||||
return WRONG;
|
||||
--t;
|
||||
--hi;
|
||||
}
|
||||
if (lo > hi)
|
||||
|
||||
Reference in New Issue
Block a user