Index: content/common/sandbox_win.cc |
diff --git a/content/common/sandbox_win.cc b/content/common/sandbox_win.cc |
index 8398b798d06080dd6cd0e9281ad07005c95b49a8..1966145c36f5ccd0df877779eb8a6cedf2e24aac 100644 |
--- a/content/common/sandbox_win.cc |
+++ b/content/common/sandbox_win.cc |
@@ -9,6 +9,7 @@ |
#include "base/base_switches.h" |
#include "base/command_line.h" |
#include "base/debug/profiler.h" |
+#include "base/environment.h" |
#include "base/files/file_util.h" |
#include "base/hash.h" |
#include "base/metrics/sparse_histogram.h" |
@@ -16,6 +17,7 @@ |
#include "base/process/launch.h" |
#include "base/strings/string_util.h" |
#include "base/strings/stringprintf.h" |
+#include "base/strings/utf_string_conversions.h" |
#include "base/trace_event/trace_event.h" |
#include "base/win/iat_patch_function.h" |
#include "base/win/scoped_handle.h" |
@@ -356,6 +358,23 @@ bool AddGenericPolicy(sandbox::TargetPolicy* policy) { |
return false; |
#endif |
+#if defined(SANITIZER_COVERAGE) |
+ scoped_ptr<base::Environment> env(base::Environment::Create()); |
+ std::string coverage_dir; |
+ if (!env->GetVar("SANITIZER_COVERAGE_DIR", &coverage_dir)) { |
+ LOG(WARNING) << "SANITIZER_COVERAGE_DIR was not set, coverage won't work."; |
+ } else { |
+ base::FilePath sancov_path = |
+ base::FilePath(base::UTF16ToWide(base::ASCIIToUTF16(coverage_dir))) |
+ .Append(L"*.sancov"); |
cpu_(ooo_6.6-7.5)
2015/05/01 17:18:58
use the native environment function so you don't h
|
+ result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, |
+ sandbox::TargetPolicy::FILES_ALLOW_ANY, |
+ sancov_path.value().c_str()); |
+ if (result != sandbox::SBOX_ALL_OK) |
+ return false; |
+ } |
+#endif |
+ |
AddGenericDllEvictionPolicy(policy); |
return true; |
} |