MCPcopy Create free account
hub / github.com/HexHive/NASS / SetSignalHandler

Function SetSignalHandler

fuzz/libfuzzer/FuzzerUtilWindows.cpp:128–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126static void CrashHandler(int) { Fuzzer::StaticCrashSignalCallback(); }
127
128void SetSignalHandler(const FuzzingOptions& Options) {
129 HandlerOpt = &Options;
130
131 if (Options.HandleAlrm && Options.UnitTimeoutSec > 0)
132 Timer.SetTimer(Options.UnitTimeoutSec / 2 + 1);
133
134 if (Options.HandleInt || Options.HandleTerm)
135 if (!SetConsoleCtrlHandler(CtrlHandler, TRUE)) {
136 DWORD LastError = GetLastError();
137 Printf("libFuzzer: SetConsoleCtrlHandler failed (Error code: %lu).\n",
138 LastError);
139 exit(1);
140 }
141
142 if (Options.HandleSegv || Options.HandleBus || Options.HandleIll ||
143 Options.HandleFpe || Options.HandleWinExcept)
144 SetUnhandledExceptionFilter(ExceptionHandler);
145
146 if (Options.HandleAbrt)
147 if (SIG_ERR == signal(SIGABRT, CrashHandler)) {
148 Printf("libFuzzer: signal failed with %d\n", errno);
149 exit(1);
150 }
151}
152
153void SleepSeconds(int Seconds) { Sleep(Seconds * 1000); }
154

Callers

nothing calls this directly

Calls 3

signalFunction · 0.85
SetTimerMethod · 0.80
PrintfFunction · 0.70

Tested by

no test coverage detected