You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-01 06:46:55 +03:00
fix(ubsan): MCOL-5844 - iron out UBSAN reports
The most important fix here is the fix of possible buffer overrun in DATEFORMAT() function. A "%W" format, repeated enough times, would overflow the 256-bytes buffer for result. Now we use ostringstream to construct result and we are safe. Changes in date/time projection functions made me fix difference between us and server behavior. The new, better behavior is reflected in changes in tests' results. Also, there was incorrect logic in TRUNCATE() and ROUND() functions in computing the decimal "shift."
This commit is contained in:
committed by
Leonid Fedorov
parent
3bcc2e2fda
commit
39a976c39a
@ -69,7 +69,8 @@ class TimeExtractor
|
||||
|
||||
uint32_t yearfirst = helpers::calc_mysql_daynr(dateTime.year, 1, 1);
|
||||
// figure out which day of week Jan-01 is
|
||||
uint32_t firstweekday = helpers::calc_mysql_weekday(dateTime.year, 1, 1, sundayFirst);
|
||||
bool isNullDummy = false;
|
||||
uint32_t firstweekday = helpers::calc_mysql_weekday(dateTime.year, 1, 1, sundayFirst, isNullDummy);
|
||||
|
||||
// calculate the offset to the first week starting day
|
||||
uint32_t firstoffset = firstweekday ? (7 - firstweekday) : 0;
|
||||
|
Reference in New Issue
Block a user