diff --git a/src/Compression/tests/gtest_compressionCodec.cpp b/src/Compression/tests/gtest_compressionCodec.cpp index a8ab53b7089..b1b68057c65 100644 --- a/src/Compression/tests/gtest_compressionCodec.cpp +++ b/src/Compression/tests/gtest_compressionCodec.cpp @@ -1213,7 +1213,13 @@ auto PrimesWithMultiplierGenerator = [](int multiplier = 1) static const size_t count = sizeof(vals)/sizeof(vals[0]); using T = decltype(i); - return static_cast(vals[i % count] * static_cast(multiplier)); + UInt64 ret; + do { + ret = static_cast(vals[i % count]) * multiplier; + --i; + } while (ret > std::numeric_limits::max()); + + return static_cast(ret); }; };