Fix UBSan report in arraySlice

This commit is contained in:
Alexey Milovidov 2021-01-22 23:35:16 +03:00
parent 7d4945a073
commit fb71a0704e
3 changed files with 4 additions and 2 deletions

View File

@ -119,7 +119,7 @@ public:
if (offset > 0)
sink = GatherUtils::sliceFromLeftConstantOffsetUnbounded(*source, static_cast<size_t>(offset - 1));
else
sink = GatherUtils::sliceFromRightConstantOffsetUnbounded(*source, static_cast<size_t>(-offset));
sink = GatherUtils::sliceFromRightConstantOffsetUnbounded(*source, -static_cast<size_t>(offset));
}
else if (isColumnConst(*length_column))
{
@ -127,7 +127,7 @@ public:
if (offset > 0)
sink = GatherUtils::sliceFromLeftConstantOffsetBounded(*source, static_cast<size_t>(offset - 1), length);
else
sink = GatherUtils::sliceFromRightConstantOffsetBounded(*source, static_cast<size_t>(-offset), length);
sink = GatherUtils::sliceFromRightConstantOffsetBounded(*source, -static_cast<size_t>(offset), length);
}
else
sink = GatherUtils::sliceDynamicOffsetBounded(*source, *offset_column, *length_column);

View File

@ -0,0 +1 @@
[0,0,0]

View File

@ -0,0 +1 @@
SELECT arraySlice(groupArray(x), -9223372036854775808, NULL) AS y FROM (SELECT '6553.5', uniqState(NULL) AS x FROM numbers(3) GROUP BY number);