forked from OSchip/llvm-project
[libFuzzer] Properly use unsigned for Process ID.
Use unsigned for PID instead of signed int. GetCurrentProcessId() returns an unsigned (DWORD) so we must be sure we can deal with all possible values. I use a long unsigned to be sure it can hold a 32 bit unsigned (DWORD). Differential Revision: https://reviews.llvm.org/D27281 llvm-svn: 289558
This commit is contained in:
parent
c59b692c85
commit
463f8bdd0b
|
@ -265,7 +265,7 @@ void Fuzzer::StaticInterruptCallback() {
|
|||
}
|
||||
|
||||
void Fuzzer::CrashCallback() {
|
||||
Printf("==%d== ERROR: libFuzzer: deadly signal\n", GetPid());
|
||||
Printf("==%lu== ERROR: libFuzzer: deadly signal\n", GetPid());
|
||||
if (EF->__sanitizer_print_stack_trace)
|
||||
EF->__sanitizer_print_stack_trace();
|
||||
Printf("NOTE: libFuzzer has rudimentary signal handlers.\n"
|
||||
|
@ -278,7 +278,7 @@ void Fuzzer::CrashCallback() {
|
|||
}
|
||||
|
||||
void Fuzzer::InterruptCallback() {
|
||||
Printf("==%d== libFuzzer: run interrupted; exiting\n", GetPid());
|
||||
Printf("==%lu== libFuzzer: run interrupted; exiting\n", GetPid());
|
||||
PrintFinalStats();
|
||||
_Exit(0); // Stop right now, don't perform any at-exit actions.
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ void Fuzzer::AlarmCallback() {
|
|||
Printf(" and the timeout value is %d (use -timeout=N to change)\n",
|
||||
Options.UnitTimeoutSec);
|
||||
DumpCurrentUnit("timeout-");
|
||||
Printf("==%d== ERROR: libFuzzer: timeout after %d seconds\n", GetPid(),
|
||||
Printf("==%lu== ERROR: libFuzzer: timeout after %d seconds\n", GetPid(),
|
||||
Seconds);
|
||||
if (EF->__sanitizer_print_stack_trace)
|
||||
EF->__sanitizer_print_stack_trace();
|
||||
|
@ -312,7 +312,7 @@ void Fuzzer::AlarmCallback() {
|
|||
|
||||
void Fuzzer::RssLimitCallback() {
|
||||
Printf(
|
||||
"==%d== ERROR: libFuzzer: out-of-memory (used: %zdMb; limit: %zdMb)\n",
|
||||
"==%lu== ERROR: libFuzzer: out-of-memory (used: %zdMb; limit: %zdMb)\n",
|
||||
GetPid(), GetPeakRSSMb(), Options.RssLimitMb);
|
||||
Printf(" To change the out-of-memory limit use -rss_limit_mb=<N>\n\n");
|
||||
if (EF->__sanitizer_print_memory_profile)
|
||||
|
|
|
@ -47,7 +47,7 @@ void SetSignalHandler(const FuzzingOptions& Options);
|
|||
|
||||
void SleepSeconds(int Seconds);
|
||||
|
||||
int GetPid();
|
||||
unsigned long GetPid();
|
||||
|
||||
size_t GetPeakRSSMb();
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ void SleepSeconds(int Seconds) {
|
|||
sleep(Seconds); // Use C API to avoid coverage from instrumented libc++.
|
||||
}
|
||||
|
||||
int GetPid() { return getpid(); }
|
||||
unsigned long GetPid() { return (unsigned long)getpid(); }
|
||||
|
||||
size_t GetPeakRSSMb() {
|
||||
struct rusage usage;
|
||||
|
|
|
@ -140,7 +140,7 @@ void SetSignalHandler(const FuzzingOptions& Options) {
|
|||
|
||||
void SleepSeconds(int Seconds) { Sleep(Seconds * 1000); }
|
||||
|
||||
int GetPid() { return GetCurrentProcessId(); }
|
||||
unsigned long GetPid() { return GetCurrentProcessId(); }
|
||||
|
||||
size_t GetPeakRSSMb() {
|
||||
PROCESS_MEMORY_COUNTERS info;
|
||||
|
|
Loading…
Reference in New Issue