Fix UBSan report in addMonths

This commit is contained in:
Alexey Milovidov 2021-03-22 23:42:09 +03:00
parent 6a7d873ea2
commit 3952a8e976
3 changed files with 4 additions and 1 deletions

View File

@ -1073,7 +1073,7 @@ public:
{
const Values & values = lut[toLUTIndex(v)];
Int64 month = static_cast<Int64>(values.month) + delta;
Int64 month = values.month + static_cast<UInt64>(delta); /// Cast is to avoid UB in signed integer overflow.
if (month > 0)
{

View File

@ -0,0 +1 @@
0

View File

@ -0,0 +1,2 @@
-- Result does not make sense but UBSan report should not be triggered.
SELECT ignore(now() + INTERVAL 9223372036854775807 MONTH);