diff --git a/tests/src/unit-bon8.cpp b/tests/src/unit-bon8.cpp index 3866180ba..030e1d5c3 100644 --- a/tests/src/unit-bon8.cpp +++ b/tests/src/unit-bon8.cpp @@ -105,7 +105,15 @@ using bytes = std::vector; /// @return the string with the given bytes std::string str(const bytes& b) { - return {b.begin(), b.end()}; + // converted one by one: constructing the string from the byte range + // converts implicitly, which -fsanitize=integer reports for bytes >= 0x80 + std::string result; + result.reserve(b.size()); + for (const auto c : b) + { + result.push_back(static_cast(c)); + } + return result; } /// check that @a j is serialized to @a expected and that @a expected is read back as @a j