(you don't have to strictly follow this form)

**Describe the bug**

https://s3.amazonaws.com/clickhouse-test-reports/31476/c034491da95909fa5a6b1a9a4f72a609fcf30d7c/fuzzer_astfuzzermsan,actions//report.html

Assertion of memory sanitizer:
```
SUMMARY: MemorySanitizer: use-of-uninitialized-value obj-x86_64-linux-gnu/../src/Common/PODArray.h:132:13 in DB::PODArrayBase<8ul, 32ul, DB::MixedArenaAllocator<4096ul, Allocator, DB::AlignedArenaAllocator<8ul>, 8ul>, 0ul, 0ul>::dealloc() Received signal -3 Received signal Unknown signal (-3) Received signal 6 Received signal Aborted (6)
```

**How to reproduce**
```sql
SELECT arrayMap(x -> finalizeAggregation(x), state) FROM (SELECT groupArrayResample(9223372036854775806, 1048575, 65537)(number, number % 3), groupArrayStateResample(10, 2147483648, 65535)(number, number % 9223372036854775806) AS state FROM numbers(100))
```

#include <AggregateFunctions/IAggregateFunction.h>
#include <AggregateFunctions/AggregateFunctionFactory.h>
#include <AggregateFunctions/FactoryHelpers.h>
#include <AggregateFunctions/Helpers.h>
#include <Columns/ColumnArray.h>
#include <Columns/ColumnsNumber.h>
#include <DataTypes/DataTypeArray.h>
#include <DataTypes/DataTypesNumber.h>
#include <IO/ReadHelpers.h>
#include <IO/WriteHelpers.h>
namespace DB
{
struct Settings;
namespace ErrorCodes
{
    extern const int ILLEGAL_TYPE_OF_ARGUMENT;
    extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
}
/** The function takes arguments x1, x2, ... xn, y. All arguments are bool.
  * x arguments represents the fact that some category is true.
  *
  * It calculates how many times y was true and how many times y was false when every n-th category was true
  * and the total number of times y was true and false.
  *
  * So, the size of the state is (n + 1) * 2 cells.
  */
class AggregateFunctionCategoricalIV final : public IAggregateFunctionHelper<AggregateFunctionCategoricalIV>