1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

MCOL-1647 Fix TIME regressions

Fixes the following:

* Read past buffer end in intToDatetime / intToTime
* Allow intToTime to convert datetime
* Allow intToTime to convert shortened time values
* Allow stringToTime to convert datetime and int time values
* Fix saturation / bad values in intToTime and stringToTime
* Fix TIME return in STR_TO_DATE()
* Fix NULL return on type inequality for TIMEDIFF()
* Fix zero day calculation error in ADDTIME()/SUBTIME()
* Fix DATETIME to int calculation error in aggregate bit operations
* Make the new harderning flags optional with -DSECURITY_HARDENED_NEW
This commit is contained in:
Andrew Hutchings
2018-08-17 07:55:51 +01:00
parent 934667f02b
commit 580a3ec123
8 changed files with 122 additions and 39 deletions

View File

@ -198,6 +198,24 @@ int64_t Func_str_to_date::getDatetimeIntVal(rowgroup::Row& row,
return time;
}
int64_t Func_str_to_date::getTimeIntVal(rowgroup::Row& row,
FunctionParm& parm,
bool& isNull,
CalpontSystemCatalog::ColType& ct)
{
dataconvert::DateTime dateTime;
dataconvert::Time retTime;
dateTime = getDateTime(row, parm, isNull, ct);
retTime.day = 0;
retTime.is_neg = false;
retTime.hour = dateTime.hour;
retTime.minute = dateTime.minute;
retTime.second = dateTime.second;
retTime.msecond = dateTime.msecond;
int64_t time = *(reinterpret_cast<int64_t*>(&retTime));
return time;
}
int64_t Func_str_to_date::getIntVal(rowgroup::Row& row,
FunctionParm& parm,
bool& isNull,