mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Check out of range values in FieldVisitorConverToNumber
This commit is contained in:
parent
f33498c73b
commit
1f2226b9db
@ -188,10 +188,17 @@ public:
|
||||
}
|
||||
|
||||
if constexpr (std::is_same_v<Decimal256, T>)
|
||||
{
|
||||
return Int256(x);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (x > std::numeric_limits<T>::max() || x < std::numeric_limits<T>::lowest())
|
||||
throw Exception("Cannot convert out of range floating point value to integer type", ErrorCodes::CANNOT_CONVERT_TYPE);
|
||||
|
||||
return T(x);
|
||||
}
|
||||
}
|
||||
|
||||
T operator() (const UInt128 &) const
|
||||
{
|
||||
|
2
tests/queries/0_stateless/01804_uniq_up_to_ubsan.sql
Normal file
2
tests/queries/0_stateless/01804_uniq_up_to_ubsan.sql
Normal file
@ -0,0 +1,2 @@
|
||||
SELECT uniqUpTo(1e100)(number) FROM numbers(5); -- { serverError 70 }
|
||||
SELECT uniqUpTo(-1e100)(number) FROM numbers(5); -- { serverError 70 }
|
Loading…
Reference in New Issue
Block a user