mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-12 09:22:05 +00:00
fix toUInt256 stack overflow
This commit is contained in:
parent
c7e88087cd
commit
268b15f221
@ -153,6 +153,9 @@ struct ConvertImpl
|
|||||||
{
|
{
|
||||||
if constexpr (std::is_same_v<FromFieldType, UInt128> || std::is_same_v<ToFieldType, UInt128>)
|
if constexpr (std::is_same_v<FromFieldType, UInt128> || std::is_same_v<ToFieldType, UInt128>)
|
||||||
throw Exception("Unexpected UInt128 to big int conversion", ErrorCodes::NOT_IMPLEMENTED);
|
throw Exception("Unexpected UInt128 to big int conversion", ErrorCodes::NOT_IMPLEMENTED);
|
||||||
|
/// If From Data is Nan or Inf, throw exception
|
||||||
|
else if (!isFinite(vec_from[i]))
|
||||||
|
throw Exception("Unexpected inf or nan to big int conversion", ErrorCodes::NOT_IMPLEMENTED);
|
||||||
else
|
else
|
||||||
vec_to[i] = bigint_cast<ToFieldType>(vec_from[i]);
|
vec_to[i] = bigint_cast<ToFieldType>(vec_from[i]);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
-9223372036854775808
|
||||||
|
170141183460469231731687303715884105727
|
||||||
|
-9223372036854775808
|
||||||
|
170141183460469231731687303715884105727
|
||||||
|
0
|
||||||
|
0
|
@ -0,0 +1,10 @@
|
|||||||
|
SELECT toInt64(inf);
|
||||||
|
SELECT toInt128(inf);
|
||||||
|
SELECT toInt256(inf); -- { serverError 48 }
|
||||||
|
SELECT toInt64(nan);
|
||||||
|
SELECT toInt128(nan);
|
||||||
|
SELECT toInt256(nan); -- { serverError 48 }
|
||||||
|
SELECT toUInt64(inf);
|
||||||
|
SELECT toUInt256(inf); -- { serverError 48 }
|
||||||
|
SELECT toUInt64(nan);
|
||||||
|
SELECT toUInt256(nan); -- { serverError 48 }
|
Loading…
Reference in New Issue
Block a user