1
0
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:
Serguey Zefirov
2024-11-21 14:52:01 +03:00
committed by Leonid Fedorov
parent 3bcc2e2fda
commit 39a976c39a
26 changed files with 207 additions and 133 deletions

View File

@ -321,9 +321,9 @@ NULL NULL
SELECT t1_t, EXTRACT(HOUR_MICROSECOND FROM t1_t) FROM t1 ORDER BY 1;
t1_t EXTRACT(HOUR_MICROSECOND FROM t1_t)
NULL NULL
11:11:11 -558149696
11:11:11 -558149696
12:12:12 952915712
11:11:11 111111000000
11:11:11 111111000000
12:12:12 121212000000
SELECT t1_t, EXTRACT(HOUR_SECOND FROM t1_t) FROM t1 ORDER BY 1;
t1_t EXTRACT(HOUR_SECOND FROM t1_t)
NULL NULL
@ -339,9 +339,9 @@ NULL NULL
SELECT t1_t, EXTRACT(DAY_MICROSECOND FROM t1_t) FROM t1 ORDER BY 1;
t1_t EXTRACT(DAY_MICROSECOND FROM t1_t)
NULL NULL
11:11:11 -558149696
11:11:11 -558149696
12:12:12 952915712
11:11:11 111111000000
11:11:11 111111000000
12:12:12 121212000000
SELECT t1_t, EXTRACT(DAY_SECOND FROM t1_t) FROM t1 ORDER BY 1;
t1_t EXTRACT(DAY_SECOND FROM t1_t)
NULL NULL