Fix issue found by fuzzer

This commit is contained in:
Salvatore Mesoraca 2023-08-17 14:57:34 +02:00
parent 08e443b766
commit c2340d588f
No known key found for this signature in database
GPG Key ID: 0567E50A25403074
3 changed files with 10 additions and 2 deletions

View File

@ -126,6 +126,9 @@ namespace impl
if (!checkColumn<ColumnUInt64>(*ret.key1))
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "second element of the key tuple is not UInt64");
if (ret.size() == 1)
ret.is_const = true;
return ret;
}
}
@ -1384,8 +1387,7 @@ private:
icolumn->getName(), icolumn->size(), vec_to.size(), getName());
if constexpr (Keyed)
if ((!key_cols.is_const && key_cols.size() != vec_to.size())
|| (key_cols.is_const && key_cols.size() != 1))
if (key_cols.size() != vec_to.size() && key_cols.size() != 1)
throw Exception(ErrorCodes::LOGICAL_ERROR, "Key column size {} doesn't match result column size {} of function {}", key_cols.size(), vec_to.size(), getName());
if (which.isUInt8()) executeIntType<UInt8, first>(key_cols, icolumn, vec_to);

View File

@ -234,3 +234,5 @@ Check multiple keys as separate ints from a table with constant data
F6D93D8FEA6D7DECCDD95A7A0A2AA36D
Check asan bug
0
Check bug found fuzzing
9042C6691B1A75F0EA3314B6F55728BB

View File

@ -334,3 +334,7 @@ DROP TABLE sipHashKeyed_keys;
SELECT 'Check asan bug';
SELECT sipHash128((toUInt64(9223372036854775806), 1)) = sipHash128(1) GROUP BY sipHash128(1::UInt8), toUInt64(9223372036854775806);
SELECT 'Check bug found fuzzing';
SELECT [(255, 1048575)], sipHash128ReferenceKeyed((toUInt64(2147483646), toUInt64(9223372036854775807)), ([(NULL, 100), (NULL, NULL), (1024, 10)], toUInt64(2), toUInt64(1024)), ''), hex(sipHash128ReferenceKeyed((-9223372036854775807, 1.), '-1', NULL)), ('', toUInt64(65535), [(9223372036854775807, 9223372036854775806)], toUInt64(65536)), arrayJoin((NULL, 65537, 255), [(NULL, NULL)]) GROUP BY tupleElement((NULL, NULL, NULL, -1), toUInt64(2), 2) = NULL; -- { serverError NOT_IMPLEMENTED }
SELECT hex(sipHash128ReferenceKeyed((0::UInt64, 0::UInt64), ([1, 1])));