1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

Fixes of bugs from ASAN warnings, part one (#2796)

This commit is contained in:
Leonid Fedorov
2023-03-30 18:29:04 +03:00
committed by GitHub
parent a1d20d82d5
commit 2f153184c3
71 changed files with 591 additions and 2038 deletions

View File

@ -1072,7 +1072,6 @@ IDB_Decimal Func_cast_decimal::getDecimalVal(Row& row, FunctionParm& parm, bool&
if (decimal.isTSInt128ByPrecision())
{
int128_t max_number_decimal = datatypes::ConversionRangeMaxValue[max_length - 19];
uint128_t uval = parm[0]->data()->getUintVal(row, isNull);
if (uval > (uint128_t)datatypes::Decimal::maxInt128)

View File

@ -591,6 +591,12 @@ uint64_t dateAdd(uint64_t time, const string& expr, IntervalColumn::interval_typ
if (-day < month_length[monthSave])
{
if (monthSave == 0)
{
monthSave = 12;
tmpYear--;
}
month--;
monthSave--;
@ -613,6 +619,12 @@ uint64_t dateAdd(uint64_t time, const string& expr, IntervalColumn::interval_typ
// BUG 5448 - changed from '==' to '<='
if (day <= 0)
{
if (monthSave == 0)
{
monthSave = 12;
tmpYear--;
}
month--;
monthSave--;
@ -635,6 +647,17 @@ uint64_t dateAdd(uint64_t time, const string& expr, IntervalColumn::interval_typ
break;
}
if (monthSave == 0)
{
monthSave = 12;
tmpYear--;
if (isLeapYear(tmpYear))
month_length[2] = 29;
else
month_length[2] = 28;
}
month--;
monthSave--;

View File

@ -37,7 +37,7 @@ std::string Func_json_unquote::getStrVal(rowgroup::Row& row, FunctionParm& fp, b
if (unlikely(jsEg.s.error) || jsEg.value_type != JSON_VALUE_STRING)
return js.data();
char* buf = (char*)alloca(jsEg.value_len);
char* buf = (char*)alloca(jsEg.value_len + 1);
if ((strLen = json_unescape(cs, jsEg.value, jsEg.value + jsEg.value_len, &my_charset_utf8mb3_general_ci,
(uchar*)buf, (uchar*)(buf + jsEg.value_len))) >= 0)
{