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
@ -323,6 +323,19 @@ inline void ArithmeticOperator::evaluate(rowgroup::Row& row, bool& isNull, Parse
|
||||
template <typename result_t>
|
||||
inline result_t ArithmeticOperator::execute(result_t op1, result_t op2, bool& isNull)
|
||||
{
|
||||
if (isNull)
|
||||
{
|
||||
// at least one operand is NULL.
|
||||
// do nothing, return 0.
|
||||
if constexpr (std::is_same<T, datatypes::TSInt128>::value)
|
||||
{
|
||||
return datatypes::TSInt128(); // returns 0
|
||||
}
|
||||
else
|
||||
{
|
||||
return T{0};
|
||||
}
|
||||
}
|
||||
switch (fOp)
|
||||
{
|
||||
case OP_ADD: return op1 + op2;
|
||||
|
Reference in New Issue
Block a user