Index: compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp =================================================================== --- compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp +++ compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp @@ -236,9 +236,14 @@ } void SetThreadName(std::thread &thread, const std::string &name) { - wchar_t wname[16]; - if (MultiByteToWideChar(CP_UTF8, 0, name.c_str(), -1, wname, 16) > 0) - (void)SetThreadDescription(thread.native_handle(), wname); + auto sz = MultiByteToWideChar(CP_UTF8, 0, name.data(), name.size(), nullptr, 0); + if (sz > 0) { + std::wstring wname(sz); + if (MultiByteToWideChar(CP_UTF8, 0, name.data, name.size, &wname[0], sz) > 0) { + wname.resize(sz - 1); + (void)SetThreadDescription(thread.native_handle(), wname.c_str()); + } + } } } // namespace fuzzer