Index: lib/Fuzzer/FuzzerIO.h =================================================================== --- lib/Fuzzer/FuzzerIO.h +++ lib/Fuzzer/FuzzerIO.h @@ -69,6 +69,8 @@ void DiscardOutput(int Fd); +void* 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,7 @@ if (NewOutputFile) { OutputFile = NewOutputFile; if (EF->__sanitizer_set_report_fd) - EF->__sanitizer_set_report_fd(reinterpret_cast(OutputFd)); + EF->__sanitizer_set_report_fd(GetHandleFromFd(OutputFd)); DiscardOutput(2); } } Index: lib/Fuzzer/FuzzerIOPosix.cpp =================================================================== --- lib/Fuzzer/FuzzerIOPosix.cpp +++ lib/Fuzzer/FuzzerIOPosix.cpp @@ -83,6 +83,10 @@ fclose(Temp); } +void* GetHandleFromFd(int fd) { + return static_cast(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); } +void* GetHandleFromFd(int fd) { + return reinterpret_cast(_get_osfhandle(fd)); +} + static bool IsSeparator(char C) { return C == '\\' || C == '/'; }