mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Fixed overflow in rounding functions with integer argument and large negative scale [#CLICKHOUSE-2]
This commit is contained in:
parent
aca29588c7
commit
80f155cfda
@ -87,7 +87,7 @@ struct IntegerRoundingComputation
|
||||
return scale;
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE T computeImpl(T x, T scale)
|
||||
static ALWAYS_INLINE T computeImpl(T x, size_t scale)
|
||||
{
|
||||
switch (rounding_mode)
|
||||
{
|
||||
@ -122,7 +122,7 @@ struct IntegerRoundingComputation
|
||||
}
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE T compute(T x, T scale)
|
||||
static ALWAYS_INLINE T compute(T x, size_t scale)
|
||||
{
|
||||
switch (scale_mode)
|
||||
{
|
||||
|
1
dbms/tests/queries/0_stateless/00811_garbage.reference
Normal file
1
dbms/tests/queries/0_stateless/00811_garbage.reference
Normal file
@ -0,0 +1 @@
|
||||
0
|
4
dbms/tests/queries/0_stateless/00811_garbage.sql
Normal file
4
dbms/tests/queries/0_stateless/00811_garbage.sql
Normal file
@ -0,0 +1,4 @@
|
||||
SET send_logs_level = 'none';
|
||||
|
||||
SELECT truncate(895, -16);
|
||||
SELECT ( SELECT toDecimal128([], rowNumberInBlock()) ) , lcm('', [[(CAST(('>A') AS String))]]); -- { serverError 44 }
|
@ -1,6 +1,4 @@
|
||||
SELECT sequenceCount((CAST((( SELECT NULL ) AS rg, ( SELECT ( SELECT [], '<e', caseWithExpr([NULL], -588755.149, []), retention(addWeeks((CAST((-7644612.39732) AS DateTime)), -23578040.02833), (CAST(([]) AS DateTime)), (CAST(([010977.08]) AS String))), emptyArrayToSingle('') ) , '\0', toUInt64([], 't3hw@'), '\0', toStartOfQuarter(-4230.1872, []) ) ) AS Date)));
|
||||
SELECT ( SELECT toDecimal128([], rowNumberInBlock()) ) , lcm('', [[(CAST(('>A') AS String))]]);
|
||||
SELECT truncate(895, -16);
|
||||
SELECT subtractDays((CAST((-5263074.47) AS DateTime)), -737895);
|
||||
SELECT quantileDeterministic([], findClusterIndex(( SELECT subtractDays((CAST((566450.398706) AS DateTime)), 54) ) )), '\0', [];
|
||||
SELECT addDays((CAST((96.338) AS DateTime)), -3);
|
||||
|
@ -32,7 +32,8 @@ inline uint64_t intExp10(int x)
|
||||
return table[x];
|
||||
}
|
||||
|
||||
namespace common {
|
||||
namespace common
|
||||
{
|
||||
|
||||
inline int exp10_i32(int x)
|
||||
{
|
||||
@ -123,4 +124,4 @@ inline __int128 exp10_i128(int x)
|
||||
return values[x];
|
||||
}
|
||||
|
||||
} // common
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user