You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +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
@ -109,11 +109,11 @@ long long dateGet(uint64_t time, IntervalColumn::interval_type unit, bool dateTy
|
||||
|
||||
long long timeGet(uint64_t time, IntervalColumn::interval_type unit)
|
||||
{
|
||||
int32_t hour = 0, min = 0, sec = 0, msec = 0, day = 0;
|
||||
int64_t hour = 0, min = 0, sec = 0, msec = 0, day = 0;
|
||||
|
||||
min = (int32_t)((time >> 32) & 0xff);
|
||||
sec = (int32_t)((time >> 24) & 0xff);
|
||||
msec = (int32_t)((time & 0xfffff));
|
||||
min = (int64_t)((time >> 32) & 0xff);
|
||||
sec = (int64_t)((time >> 24) & 0xff);
|
||||
msec = (int64_t)((time & 0xfffff));
|
||||
|
||||
// If negative, mask so it doesn't turn positive
|
||||
int64_t mask = 0;
|
||||
|
Reference in New Issue
Block a user