mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 01:22:04 +00:00
Check for overflow before addition in anova function
This commit is contained in:
parent
1b30f91e7a
commit
c795b9c32f
@ -459,6 +459,10 @@ struct AnalysisOfVarianceMoments
|
||||
|
||||
void add(T value, size_t group)
|
||||
{
|
||||
if (group == std::numeric_limits<size_t>::max())
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Too many groups for analysis of variance (should be no more than {}, got {})",
|
||||
MAX_GROUPS_NUMBER, group);
|
||||
|
||||
resizeIfNeeded(group + 1);
|
||||
xs1[group] += value;
|
||||
xs2[group] += value * value;
|
||||
|
@ -0,0 +1 @@
|
||||
SELECT analysisOfVariance(1, 18446744073709551615); -- { serverError BAD_ARGUMENTS }
|
Loading…
Reference in New Issue
Block a user