Added support for non-constant and negative offset and size for substring function (continued) [#CLICKHOUSE-2].

This commit is contained in:
Alexey Milovidov 2017-07-24 09:53:21 +03:00
parent 11497742bd
commit bbf6d36072

View File

@ -878,7 +878,7 @@ public:
{
start_value = column_start_const->getInt(0);
if (start_value > 0x8000000000000000ULL) /// Larger value could lead to overflow, then bypass bounds checking and read wrong data.
throw Exception("Too large values of second argument provided for function substring.", ErrorCodes::ARGUMENT_OUT_OF_BOUND);
throw Exception("Too large value of second argument provided for function substring.", ErrorCodes::ARGUMENT_OUT_OF_BOUND);
}
if (column_length_const)
{
@ -886,7 +886,7 @@ public:
if (length_value < 0)
throw Exception("Third argument provided for function substring could not be negative.", ErrorCodes::ARGUMENT_OUT_OF_BOUND);
if (length_value > 0x8000000000000000ULL)
throw Exception("Too large values of second argument provided for function substring.", ErrorCodes::ARGUMENT_OUT_OF_BOUND);
throw Exception("Too large value of third argument provided for function substring.", ErrorCodes::ARGUMENT_OUT_OF_BOUND);
}
if (const ColumnString * col = checkAndGetColumn<ColumnString>(&*column_string))