diff options
| author | robot-piglet <[email protected]> | 2025-01-06 16:20:27 +0300 |
|---|---|---|
| committer | robot-piglet <[email protected]> | 2025-01-06 16:31:02 +0300 |
| commit | 5098d8d5e47c4228968a0f28ab95f43cd52abc2e (patch) | |
| tree | 7bb3da14c1150696006794b8afe9370fce4658ef /contrib/libs/libfuzzer/lib | |
| parent | 8d6b1d92f402825e2759564bc561ea677f0f802d (diff) | |
Intermediate changes
commit_hash:eb0650680daaad11cb87780fed3a94fb37d55eee
Diffstat (limited to 'contrib/libs/libfuzzer/lib')
5 files changed, 31 insertions, 7 deletions
diff --git a/contrib/libs/libfuzzer/lib/fuzzer/FuzzerDriver.cpp b/contrib/libs/libfuzzer/lib/fuzzer/FuzzerDriver.cpp index 1937b14bc91..093cd9e3c30 100644 --- a/contrib/libs/libfuzzer/lib/fuzzer/FuzzerDriver.cpp +++ b/contrib/libs/libfuzzer/lib/fuzzer/FuzzerDriver.cpp @@ -229,6 +229,7 @@ static void PulseThread() { static void WorkerThread(const Command &BaseCmd, std::atomic<unsigned> *Counter, unsigned NumJobs, std::atomic<bool> *HasErrors) { + ScopedDisableMsanInterceptorChecks S; while (true) { unsigned C = (*Counter)++; if (C >= NumJobs) break; diff --git a/contrib/libs/libfuzzer/lib/fuzzer/FuzzerFork.cpp b/contrib/libs/libfuzzer/lib/fuzzer/FuzzerFork.cpp index c248a1d246a..e544cd846e4 100644 --- a/contrib/libs/libfuzzer/lib/fuzzer/FuzzerFork.cpp +++ b/contrib/libs/libfuzzer/lib/fuzzer/FuzzerFork.cpp @@ -349,7 +349,7 @@ void FuzzWithFork(Random &Rand, const FuzzingOptions &Options, &NewFeatures, Env.Cov, &NewCov, CFPath, /*Verbose=*/false, /*IsSetCoverMerge=*/false); Env.Features.insert(NewFeatures.begin(), NewFeatures.end()); - Env.Cov.insert(NewFeatures.begin(), NewFeatures.end()); + Env.Cov.insert(NewCov.begin(), NewCov.end()); RemoveFile(CFPath); } diff --git a/contrib/libs/libfuzzer/lib/fuzzer/FuzzerUtilLinux.cpp b/contrib/libs/libfuzzer/lib/fuzzer/FuzzerUtilLinux.cpp index 5729448b0be..e5409f22f0e 100644 --- a/contrib/libs/libfuzzer/lib/fuzzer/FuzzerUtilLinux.cpp +++ b/contrib/libs/libfuzzer/lib/fuzzer/FuzzerUtilLinux.cpp @@ -44,7 +44,7 @@ void SetThreadName(std::thread &thread, const std::string &name) { #if LIBFUZZER_LINUX || LIBFUZZER_FREEBSD (void)pthread_setname_np(thread.native_handle(), name.c_str()); #elif LIBFUZZER_NETBSD - (void)pthread_set_name_np(thread.native_handle(), "%s", name.c_str()); + (void)pthread_setname_np(thread.native_handle(), "%s", const_cast<char *>(name.c_str())); #endif } diff --git a/contrib/libs/libfuzzer/lib/fuzzer/FuzzerUtilWindows.cpp b/contrib/libs/libfuzzer/lib/fuzzer/FuzzerUtilWindows.cpp index 71770166805..da3eb3cfb34 100644 --- a/contrib/libs/libfuzzer/lib/fuzzer/FuzzerUtilWindows.cpp +++ b/contrib/libs/libfuzzer/lib/fuzzer/FuzzerUtilWindows.cpp @@ -21,10 +21,15 @@ #include <signal.h> #include <stdio.h> #include <sys/types.h> +// clang-format off #include <windows.h> - -// This must be included after windows.h. +// These must be included after windows.h. +// archicture need to be set before including +// libloaderapi +#include <libloaderapi.h> +#include <stringapiset.h> #include <psapi.h> +// clang-format on namespace fuzzer { @@ -234,8 +239,26 @@ size_t PageSize() { } void SetThreadName(std::thread &thread, const std::string &name) { - // TODO ? - // to UTF-8 then SetThreadDescription ? +#ifndef __MINGW32__ + // Not setting the thread name in MinGW environments. MinGW C++ standard + // libraries can either use native Windows threads or pthreads, so we + // don't know with certainty what kind of thread handle we're getting + // from thread.native_handle() here. + typedef HRESULT(WINAPI * proc)(HANDLE, PCWSTR); + HMODULE kbase = GetModuleHandleA("KernelBase.dll"); + proc ThreadNameProc = + reinterpret_cast<proc>(GetProcAddress(kbase, "SetThreadDescription")); + if (ThreadNameProc) { + std::wstring buf; + auto sz = MultiByteToWideChar(CP_UTF8, 0, name.data(), -1, nullptr, 0); + if (sz > 0) { + buf.resize(sz); + if (MultiByteToWideChar(CP_UTF8, 0, name.data(), -1, &buf[0], sz) > 0) { + (void)ThreadNameProc(thread.native_handle(), buf.c_str()); + } + } + } +#endif } } // namespace fuzzer diff --git a/contrib/libs/libfuzzer/lib/fuzzer/afl/ya.make b/contrib/libs/libfuzzer/lib/fuzzer/afl/ya.make index a27f6fa1e67..b1c8ad932ee 100644 --- a/contrib/libs/libfuzzer/lib/fuzzer/afl/ya.make +++ b/contrib/libs/libfuzzer/lib/fuzzer/afl/ya.make @@ -8,7 +8,7 @@ LICENSE_TEXTS(.yandex_meta/licenses.list.txt) SUBSCRIBER(g:cpp-contrib) -VERSION(18.1.8) +VERSION(19.1.6) PEERDIR( contrib/libs/afl/llvm_mode |
