Fixed error found by M.Filimonov (missing check for maximum size of FixedString leading to overflow in arithmetic) [#CLICKHOUSE-2].

This commit is contained in:
Alexey Milovidov 2017-12-18 23:43:10 +03:00
parent bee53d483f
commit 09fa34c764

View File

@ -2,6 +2,8 @@
#include <DataTypes/IDataType.h>
#define MAX_FIXEDSTRING_SIZE 0xFFFFFF
namespace DB
{
@ -24,6 +26,8 @@ public:
{
if (n == 0)
throw Exception("FixedString size must be positive", ErrorCodes::ARGUMENT_OUT_OF_BOUND);
if (n > MAX_FIXEDSTRING_SIZE)
throw Exception("FixedString size is too large", ErrorCodes::ARGUMENT_OUT_OF_BOUND);
}
std::string getName() const override;