Fixed fuzz test #4322

This commit is contained in:
Alexey Milovidov 2019-02-11 20:26:35 +03:00
parent 49165b1347
commit 2294575693
3 changed files with 8 additions and 0 deletions

View File

@ -12,8 +12,13 @@ namespace DB
namespace ErrorCodes
{
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
extern const int TOO_LARGE_ARRAY_SIZE;
}
/// Reasonable threshold.
static constexpr size_t max_arrays_size_in_block = 1000000000;
/* arrayWithConstant(num, const) - make array of constants with length num.
* arrayWithConstant(3, 'hello') = ['hello', 'hello', 'hello']
* arrayWithConstant(1, 'hello') = ['hello']
@ -55,6 +60,8 @@ public:
for (size_t i = 0; i < num_rows; ++i)
{
offset += col_num->getUInt(i);
if (unlikely(offset > max_arrays_size_in_block))
throw Exception("Too large array size while executing function " + getName(), ErrorCodes::TOO_LARGE_ARRAY_SIZE);
offsets.push_back(offset);
}

View File

@ -0,0 +1 @@
SELECT arrayWithConstant(-231.37104, -138); -- { serverError 128 }