ClickHouse/src/Functions/base64Decode.cpp
Kevin Michel 8356d44c70
Fix base64Encode returning corrupted data
The "fast" mode of turbo base64 seem to go too fast on small strings,
disabling the AVX2 optimisation for small string fixes the problem.

See the test named 02113_base64encode_trailing_bytes.sql for an example
of a failing case (only applies when running on a CPU with the AVX2
instruction set).

Ref. 15e044269d/turbob64.h (L106-L111)
2021-11-25 15:24:11 +01:00

19 lines
477 B
C++

#include <Functions/FunctionBase64Conversion.h>
#if USE_BASE64
#include <Functions/FunctionFactory.h>
#include <DataTypes/DataTypeString.h>
namespace DB
{
void registerFunctionBase64Decode(FunctionFactory & factory)
{
tb64ini(0, 0);
factory.registerFunction<FunctionBase64Conversion<Base64Decode>>();
/// MysQL compatibility alias.
factory.registerFunction<FunctionBase64Conversion<Base64Decode>>("FROM_BASE64", FunctionFactory::CaseInsensitive);
}
}
#endif