[NFC] Fix CodeQL violations in compiler-rt. (#157793) This pull request addresses fixes against violations happening under subcategory 'cpp/wrong-type-format-argument' related to dfsan,fuzzer,hwasan. GitOrigin-RevId: b44e6e01f7f778bbb569e07821f5ddfdb90c4d4d
diff --git a/FuzzerCorpus.h b/FuzzerCorpus.h index 48b5a2c..12a75fe 100644 --- a/FuzzerCorpus.h +++ b/FuzzerCorpus.h
@@ -336,7 +336,8 @@ void PrintFeatureSet() { for (size_t i = 0; i < kFeatureSetSize; i++) { if(size_t Sz = GetFeature(i)) - Printf("[%zd: id %zd sz%zd] ", i, SmallestElementPerFeature[i], Sz); + Printf("[%zd: id %zd sz%zd] ", i, (size_t)SmallestElementPerFeature[i], + Sz); } Printf("\n\t"); for (size_t i = 0; i < Inputs.size(); i++)
diff --git a/FuzzerDriver.cpp b/FuzzerDriver.cpp index af9c260..32b7eca 100644 --- a/FuzzerDriver.cpp +++ b/FuzzerDriver.cpp
@@ -163,13 +163,13 @@ auto Val = MyStol(Str); *FlagDescriptions[F].IntFlag = static_cast<int>(Val); if (Flags.verbosity >= 2) - Printf("Flag: %s %d\n", Name, Val); + Printf("Flag: %s %d\n", Name, (int)Val); return true; } else if (FlagDescriptions[F].UIntFlag) { auto Val = std::stoul(Str); *FlagDescriptions[F].UIntFlag = static_cast<unsigned int>(Val); if (Flags.verbosity >= 2) - Printf("Flag: %s %u\n", Name, Val); + Printf("Flag: %s %u\n", Name, (uint)Val); return true; } else if (FlagDescriptions[F].StrFlag) { *FlagDescriptions[F].StrFlag = Str;
diff --git a/FuzzerLoop.cpp b/FuzzerLoop.cpp index 6f415dd..75c2fb7 100644 --- a/FuzzerLoop.cpp +++ b/FuzzerLoop.cpp
@@ -125,8 +125,8 @@ void Fuzzer::HandleMalloc(size_t Size) { if (!Options.MallocLimitMb || (Size >> 20) < (size_t)Options.MallocLimitMb) return; - Printf("==%d== ERROR: libFuzzer: out-of-memory (malloc(%zd))\n", GetPid(), - Size); + Printf("==%d== ERROR: libFuzzer: out-of-memory (malloc(%zd))\n", + (int)GetPid(), Size); Printf(" To change the out-of-memory limit use -rss_limit_mb=<N>\n\n"); PrintStackTrace(); DumpCurrentUnit("oom-"); @@ -568,7 +568,7 @@ void Fuzzer::CrashOnOverwrittenData() { Printf("==%d== ERROR: libFuzzer: fuzz target overwrites its const input\n", - GetPid()); + (int)GetPid()); PrintStackTrace(); Printf("SUMMARY: libFuzzer: overwrites-const-input\n"); DumpCurrentUnit("crash-");