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

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


mpividori removed rL LLVM as the repository for this revision.
mpividori updated this revision to Diff 84208.

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") != 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.84208.patch
Type: text/x-patch
Size: 1681 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170113/27b0fdc3/attachment.bin>


More information about the llvm-commits mailing list