Navigation Menu

Skip to content

Commit

Permalink
Add time overflow check for 32bit environment
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Oct 24, 2012
1 parent 0c3240f commit f5dab85
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ha_mroonga.cpp
Expand Up @@ -1507,7 +1507,9 @@ static long long int mrn_tm_to_grn_time(struct tm *time, int usec)
MRN_DBUG_ENTER_FUNCTION();
long long int grn_time;
long long int sec = mktime(time);
if (sec == -1) {
bool failed = (sec == -1);
bool overflowed = (time.tm_year >= 0 && sec < 0);
if (failed || overflowed) {
grn_time = 0;
} else {
grn_time = GRN_TIME_PACK(sec + mrn_utc_diff_in_seconds, usec);
Expand Down

0 comments on commit f5dab85

Please sign in to comment.