[PATCH] D28633: [libFuzzer] Portable implementation of `IsInterestingCoverageFile()`.

Marcos Pividori via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 12 18:03:04 PST 2017


mpividori created this revision.
mpividori added reviewers: kcc, zturner.
mpividori added a subscriber: llvm-commits.
mpividori set the repository for this revision to rL LLVM.

Repository:
  rL LLVM

https://reviews.llvm.org/D28633

Files:
  lib/Fuzzer/FuzzerIO.h
  lib/Fuzzer/FuzzerIOPosix.cpp
  lib/Fuzzer/FuzzerIOWindows.cpp


Index: lib/Fuzzer/FuzzerIOWindows.cpp
===================================================================
--- lib/Fuzzer/FuzzerIOWindows.cpp
+++ lib/Fuzzer/FuzzerIOWindows.cpp
@@ -277,6 +277,16 @@
   return FileName.substr(0, LocationLen + DirLen);
 }
 
+bool IsInterestingCoverageFile(const std::string &FileName) {
+  if (FileName.find("Program Files (x86)") != std::string::npos)
+    return false;
+  if (FileName.find("compiler-rt\\lib\\") != std::string::npos)
+    return false; // sanitizer internal.
+  if (FileName == "<null>")
+    return false;
+  return true;
+}
+
 }  // namespace fuzzer
 
 #endif // LIBFUZZER_WINDOWS
Index: lib/Fuzzer/FuzzerIOPosix.cpp
===================================================================
--- lib/Fuzzer/FuzzerIOPosix.cpp
+++ lib/Fuzzer/FuzzerIOPosix.cpp
@@ -83,6 +83,18 @@
   return Res;
 }
 
+bool IsInterestingCoverageFile(const std::string &FileName) {
+  if (FileName.find("compiler-rt/lib/") != std::string::npos)
+    return false; // sanitizer internal.
+  if (FileName.find("/usr/lib/") != std::string::npos)
+    return false;
+  if (FileName.find("/usr/include/") != std::string::npos)
+    return false;
+  if (FileName == "<null>")
+    return false;
+  return true;
+}
+
 }  // namespace fuzzer
 
 #endif // LIBFUZZER_POSIX
Index: lib/Fuzzer/FuzzerIO.h
===================================================================
--- lib/Fuzzer/FuzzerIO.h
+++ lib/Fuzzer/FuzzerIO.h
@@ -37,6 +37,8 @@
 // Returns the name of the dir, similar to the 'dirname' utility.
 std::string DirName(const std::string &FileName);
 
+bool IsInterestingCoverageFile(const std::string &FileName);
+
 void DupAndCloseStderr();
 
 void CloseStdout();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28633.84206.patch
Type: text/x-patch
Size: 1687 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170113/e5bf11f1/attachment.bin>


More information about the llvm-commits mailing list