Merge pull request #27826 from Avogar/fix-short-circuit-fuzz

Fix bug in short-circuit found by fuzzer
This commit is contained in:
alexey-milovidov 2021-08-19 11:06:22 +03:00 committed by GitHub
commit 190ea327e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 664 additions and 244 deletions

View File

@ -565,7 +565,7 @@ void ColumnArray::expand(const IColumn::Filter & mask, bool inverted)
while (index >= 0)
{
offsets_data[index] = last_offset;
if (mask[index] ^ inverted)
if (!!mask[index] ^ inverted)
{
if (from < 0)
throw Exception("Too many bytes in mask", ErrorCodes::LOGICAL_ERROR);

View File

@ -354,7 +354,7 @@ void ColumnFixedString::expand(const IColumn::Filter & mask, bool inverted)
chars.resize_fill(mask.size() * n, 0);
while (index >= 0)
{
if (mask[index] ^ inverted)
if (!!mask[index] ^ inverted)
{
if (from < 0)
throw Exception("Too many bytes in mask", ErrorCodes::LOGICAL_ERROR);

View File

@ -178,7 +178,7 @@ void ColumnString::expand(const IColumn::Filter & mask, bool inverted)
while (index >= 0)
{
offsets_data[index] = last_offset;
if (mask[index] ^ inverted)
if (!!mask[index] ^ inverted)
{
if (from < 0)
throw Exception("Too many bytes in mask", ErrorCodes::LOGICAL_ERROR);

View File

@ -26,7 +26,7 @@ void expandDataByMask(PaddedPODArray<T> & data, const PaddedPODArray<UInt8> & ma
data.resize(mask.size());
while (index >= 0)
{
if (mask[index] ^ inverted)
if (!!mask[index] ^ inverted)
{
if (from < 0)
throw Exception("Too many bytes in mask", ErrorCodes::LOGICAL_ERROR);

File diff suppressed because it is too large Load Diff

View File

@ -11,82 +11,102 @@ select count() from (select if(number >= 0, number, sleep(1)) from numbers(10000
select if(number % 5 == 0, toInt8OrZero(toString(number)), toInt8OrZero(toString(number + 1))) from numbers(20);
select if(number % 5 == 0, toInt8OrZero(toString(number)), Null) from numbers(20);
select if(number % 5 == 0, Null, toInt8OrZero(toString(number))) from numbers(20);
select if(number % 5, Null, toInt8OrZero(toString(number))) from numbers(20);
select if(number % 5 == 0, toUInt8OrZero(toString(number)), toUInt8OrZero(toString(number + 1))) from numbers(20);
select if(number % 5 == 0, toUInt8OrZero(toString(number)), Null) from numbers(20);
select if(number % 5 == 0, Null, toUInt8OrZero(toString(number))) from numbers(20);
select if(number % 5, Null, toUInt8OrZero(toString(number))) from numbers(20);
select if(number % 5 == 0, toInt32OrZero(toString(number)), toInt32OrZero(toString(number + 1))) from numbers(20);
select if(number % 5 == 0, toInt32OrZero(toString(number)), Null) from numbers(20);
select if(number % 5 == 0, Null, toInt32OrZero(toString(number))) from numbers(20);
select if(number % 5, Null, toInt32OrZero(toString(number))) from numbers(20);
select if(number % 5 == 0, toUInt32OrZero(toString(number)), toUInt32OrZero(toString(number + 1))) from numbers(20);
select if(number % 5 == 0, toUInt32OrZero(toString(number)), Null) from numbers(20);
select if(number % 5 == 0, Null, toUInt32OrZero(toString(number))) from numbers(20);
select if(number % 5, Null, toUInt32OrZero(toString(number))) from numbers(20);
select if(number % 5 == 0, toInt64OrZero(toString(number)), toInt64OrZero(toString(number + 1))) from numbers(20);
select if(number % 5 == 0, toInt64OrZero(toString(number)), Null) from numbers(20);
select if(number % 5 == 0, Null, toInt64OrZero(toString(number))) from numbers(20);
select if(number % 5, Null, toInt64OrZero(toString(number))) from numbers(20);
select if(number % 5 == 0, toUInt64OrZero(toString(number)), toUInt64OrZero(toString(number + 1))) from numbers(20);
select if(number % 5 == 0, toUInt64OrZero(toString(number)), Null) from numbers(20);
select if(number % 5 == 0, Null, toUInt64OrZero(toString(number))) from numbers(20);
select if(number % 5, Null, toUInt64OrZero(toString(number))) from numbers(20);
select if(number % 5 == 0, toInt128OrZero(toString(number)), toInt128OrZero(toString(number + 1))) from numbers(20);
select if(number % 5 == 0, toInt128OrZero(toString(number)), Null) from numbers(20);
select if(number % 5 == 0, Null, toInt128OrZero(toString(number))) from numbers(20);
select if(number % 5, Null, toInt128OrZero(toString(number))) from numbers(20);
select if(number % 5 == 0, toUInt128OrZero(toString(number)), toUInt128OrZero(toString(number + 1))) from numbers(20);
select if(number % 5 == 0, toUInt128OrZero(toString(number)), Null) from numbers(20);
select if(number % 5 == 0, Null, toUInt128OrZero(toString(number))) from numbers(20);
select if(number % 5, Null, toUInt128OrZero(toString(number))) from numbers(20);
select if(number % 5 == 0, toInt256OrZero(toString(number)), toInt256OrZero(toString(number + 1))) from numbers(20);
select if(number % 5 == 0, toInt256OrZero(toString(number)), Null) from numbers(20);
select if(number % 5 == 0, Null, toInt256OrZero(toString(number))) from numbers(20);
select if(number % 5, Null, toInt256OrZero(toString(number))) from numbers(20);
select if(number % 5 == 0, toUInt256OrZero(toString(number)), toUInt256OrZero(toString(number + 1))) from numbers(20);
select if(number % 5 == 0, toUInt256OrZero(toString(number)), Null) from numbers(20);
select if(number % 5 == 0, Null, toUInt256OrZero(toString(number))) from numbers(20);
select if(number % 5, Null, toUInt256OrZero(toString(number))) from numbers(20);
select if(number % 5 == 0, toFloat32OrZero(toString(number)), toFloat32OrZero(toString(number + 1))) from numbers(20);
select if(number % 5 == 0, toFloat32OrZero(toString(number)), Null) from numbers(20);
select if(number % 5 == 0, Null, toFloat32OrZero(toString(number))) from numbers(20);
select if(number % 5, Null, toFloat32OrZero(toString(number))) from numbers(20);
select if(number % 5 == 0, toFloat64OrZero(toString(number)), toFloat64OrZero(toString(number + 1))) from numbers(20);
select if(number % 5 == 0, toFloat64OrZero(toString(number)), Null) from numbers(20);
select if(number % 5 == 0, Null, toFloat64OrZero(toString(number))) from numbers(20);
select if(number % 5, Null, toFloat64OrZero(toString(number))) from numbers(20);
select if(number % 5 == 0, repeat(toString(number), 2), repeat(toString(number + 1), 2)) from numbers(20);
select if(number % 5 == 0, repeat(toString(number), 2), Null) from numbers(20);
select if(number % 5 == 0, Null, repeat(toString(number), 2)) from numbers(20);
select if(number % 5, Null, repeat(toString(number), 2)) from numbers(20);
select if(number % 5 == 0, toFixedString(toString(number + 10), 2), toFixedString(toString(number + 11), 2)) from numbers(20);
select if(number % 5 == 0, toFixedString(toString(number + 10), 2), Null) from numbers(20);
select if(number % 5 == 0, Null, toFixedString(toString(number + 10), 2)) from numbers(20);
select if(number % 5, Null, toFixedString(toString(number + 10), 2)) from numbers(20);
select if(number % 5 == 0, toDateOrZero(toString(number)), toDateOrZero(toString(number + 1))) from numbers(20);
select if(number % 5 == 0, toDateOrZero(toString(number)), Null) from numbers(20);
select if(number % 5 == 0, Null, toDateOrZero(toString(number))) from numbers(20);
select if(number % 5, Null, toDateOrZero(toString(number))) from numbers(20);
select if(number % 5 == 0, toDateTimeOrZero(toString(number * 10000), 'UTC'), toDateTimeOrZero(toString((number + 1) * 10000), 'UTC')) from numbers(20);
select if(number % 5 == 0, toDateTimeOrZero(toString(number * 10000), 'UTC'), Null) from numbers(20);
select if(number % 5 == 0, Null, toDateTimeOrZero(toString(number * 10000), 'UTC')) from numbers(20);
select if(number % 5, Null, toDateTimeOrZero(toString(number * 10000), 'UTC')) from numbers(20);
select if(number % 5 == 0, toDecimal32OrZero(toString(number), 5), toDecimal32OrZero(toString(number + 1), 5)) from numbers(20);
select if(number % 5 == 0, toDecimal32OrZero(toString(number), 5), Null) from numbers(20);
select if(number % 5 == 0, Null, toDecimal32OrZero(toString(number), 5)) from numbers(20);
select if(number % 5, Null, toDecimal32OrZero(toString(number), 5)) from numbers(20);
select if(number % 5 == 0, toDecimal64OrZero(toString(number), 5), toDecimal64OrZero(toString(number + 1), 5)) from numbers(20);
select if(number % 5 == 0, toDecimal64OrZero(toString(number), 5), Null) from numbers(20);
select if(number % 5 == 0, Null, toDecimal64OrZero(toString(number), 5)) from numbers(20);
select if(number % 5, Null, toDecimal64OrZero(toString(number), 5)) from numbers(20);
select if(number % 5 == 0, toDecimal128OrZero(toString(number), 5), toDecimal128OrZero(toString(number + 1), 5)) from numbers(20);
select if(number % 5 == 0, toDecimal128OrZero(toString(number), 5), Null) from numbers(20);
select if(number % 5 == 0, Null, toDecimal128OrZero(toString(number), 5)) from numbers(20);
select if(number % 5, Null, toDecimal128OrZero(toString(number), 5)) from numbers(20);
select if(number % 5 == 0, toDecimal256OrZero(toString(number), 5), toDecimal256OrZero(toString(number + 1), 5)) from numbers(20);
select if(number % 5 == 0, toDecimal256OrZero(toString(number), 5), Null) from numbers(20);
select if(number % 5 == 0, Null, toDecimal256OrZero(toString(number), 5)) from numbers(20);
select if(number % 5, Null, toDecimal256OrZero(toString(number), 5)) from numbers(20);
select if(number % 5 == 0, range(number), range(number + 1)) from numbers(20);
select if(number % 5 == 0, replicate(toString(number), range(number)), replicate(toString(number), range(number + 1))) from numbers(20);