Index: lib/Fuzzer/FuzzerIO.h =================================================================== --- lib/Fuzzer/FuzzerIO.h +++ lib/Fuzzer/FuzzerIO.h @@ -69,6 +69,8 @@ void DiscardOutput(int Fd); +int GetHandleFromFd(int fd); + } // namespace fuzzer #endif // LLVM_FUZZER_IO_H Index: lib/Fuzzer/FuzzerIO.cpp =================================================================== --- lib/Fuzzer/FuzzerIO.cpp +++ lib/Fuzzer/FuzzerIO.cpp @@ -96,7 +96,8 @@ if (NewOutputFile) { OutputFile = NewOutputFile; if (EF->__sanitizer_set_report_fd) - EF->__sanitizer_set_report_fd(reinterpret_cast(OutputFd)); + EF->__sanitizer_set_report_fd(reinterpret_cast( + GetHandleFromFd(OutputFd))); DiscardOutput(2); } } Index: lib/Fuzzer/FuzzerIOPosix.cpp =================================================================== --- lib/Fuzzer/FuzzerIOPosix.cpp +++ lib/Fuzzer/FuzzerIOPosix.cpp @@ -83,6 +83,10 @@ fclose(Temp); } +int GetHandleFromFd(int fd) { + return fd; +} + std::string DirName(const std::string &FileName) { char *Tmp = new char[FileName.size() + 1]; memcpy(Tmp, FileName.c_str(), FileName.size() + 1); Index: lib/Fuzzer/FuzzerIOWindows.cpp =================================================================== --- lib/Fuzzer/FuzzerIOWindows.cpp +++ lib/Fuzzer/FuzzerIOWindows.cpp @@ -149,6 +149,10 @@ fclose(Temp); } +int GetHandleFromFd(int fd) { + return _get_osfhandle(fd); +} + static bool IsSeparator(char C) { return C == '\\' || C == '/'; }