Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix potential asan error for string tests #4279

14 changes: 8 additions & 6 deletions dbms/src/Functions/tests/gtest_strings_simd_consistency.cpp
Original file line number Diff line number Diff line change
@@ -296,9 +296,9 @@ TEST(StringsLowerUpperAscii, Random)
std::random_device device;
auto seed = device();
std::cout << "seeded with: " << seed << std::endl;
std::vector<UInt8> data(limit);
std::vector<UInt8> res_new(limit);
std::vector<UInt8> res_old(limit);
std::vector<UInt8> data(limit + 1);
std::vector<UInt8> res_new(limit + 1, 0);
std::vector<UInt8> res_old(limit + 1, 0);
std::default_random_engine eng(seed);
std::uniform_int_distribution<UInt8> dist(
'A',
@@ -307,6 +307,7 @@ TEST(StringsLowerUpperAscii, Random)
{
i = dist(eng);
}
data.back() = 0;
{
{
auto begin = high_resolution_clock::now();
@@ -332,9 +333,9 @@ TEST(StringsLowerUpperUtf8, Random)
std::random_device device;
auto seed = device();
std::cout << "seeded with: " << seed << std::endl;
std::vector<UInt8> data(limit);
std::vector<UInt8> res_new(limit, 0);
std::vector<UInt8> res_old(limit, 0);
std::vector<UInt8> data(limit + 1);
std::vector<UInt8> res_new(limit + 1, 0);
std::vector<UInt8> res_old(limit + 1, 0);
std::default_random_engine eng(seed);
std::uniform_int_distribution<UInt8> dist(
std::numeric_limits<UInt8>::min(),
@@ -343,6 +344,7 @@ TEST(StringsLowerUpperUtf8, Random)
{
i = dist(eng);
}
data.back() = 0;
{
{
auto begin = high_resolution_clock::now();