[PATCH] Fix potential int overflow in date extension.
| From: | Joshua Rogers | Date: | Mon, 19 Jan 2015 19:15:58 +0000 |
| Subject: | [PATCH] Fix potential int overflow in date extension. | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-80845@lists.php.net to get a copy of this message | ||
---
ext/date/lib/tm2unixtime.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/ext/date/lib/tm2unixtime.c b/ext/date/lib/tm2unixtime.c
index c058672..94e5254 100644
--- a/ext/date/lib/tm2unixtime.c
+++ b/ext/date/lib/tm2unixtime.c
@@ -334,9 +334,9 @@ static timelib_sll do_years(timelib_sll year)
static timelib_sll do_months(timelib_ull month, timelib_ull year)
{
if (timelib_is_leap(year)) {
- return ((month_tab_leap[month - 1] + 1) * SECS_PER_DAY);
+ return (((timelib_ull)month_tab_leap[month - 1] + 1) * SECS_PER_DAY);
} else {
- return ((month_tab[month - 1]) * SECS_PER_DAY);
+ return (((timelib_ull)month_tab[month - 1]) * SECS_PER_DAY);
}
}
@@ -361,7 +361,7 @@ static timelib_sll do_adjust_timezone(timelib_time *tz, timelib_tzinfo *tzi)
case TIMELIB_ZONETYPE_OFFSET:
tz->is_localtime = 1;
- return tz->z * 60;
+ return (timelib_sll)tz->z * 60;
break;
case TIMELIB_ZONETYPE_ABBR: {
--
1.9.1