mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Fix UBSan report in GatherUtils
This commit is contained in:
parent
d93dad0ec3
commit
248540e58f
@ -711,7 +711,7 @@ void resizeDynamicSize(ArraySource && array_source, ValueSource && value_source,
|
||||
}
|
||||
else
|
||||
{
|
||||
auto length = static_cast<size_t>(-size);
|
||||
auto length = -static_cast<size_t>(size);
|
||||
if (length > MAX_ARRAY_SIZE)
|
||||
throw Exception(ErrorCodes::TOO_LARGE_ARRAY_SIZE, "Too large array size: {}, maximum: {}",
|
||||
length, MAX_ARRAY_SIZE);
|
||||
@ -760,7 +760,7 @@ void resizeConstantSize(ArraySource && array_source, ValueSource && value_source
|
||||
}
|
||||
else
|
||||
{
|
||||
auto length = static_cast<size_t>(-size);
|
||||
auto length = -static_cast<size_t>(size);
|
||||
if (length > MAX_ARRAY_SIZE)
|
||||
throw Exception(ErrorCodes::TOO_LARGE_ARRAY_SIZE, "Too large array size: {}, maximum: {}",
|
||||
length, MAX_ARRAY_SIZE);
|
||||
|
1
tests/queries/0_stateless/01682_gather_utils_ubsan.sql
Normal file
1
tests/queries/0_stateless/01682_gather_utils_ubsan.sql
Normal file
@ -0,0 +1 @@
|
||||
SELECT arrayResize([1, 2, 3], -9223372036854775808); -- { serverError 128 }
|
Loading…
Reference in New Issue
Block a user