From c22e72e6b0eaef2946488a808839b82b3927c2e3 Mon Sep 17 00:00:00 2001 From: Mike Aizatsky Date: Thu, 28 Jan 2016 00:31:49 +0000 Subject: [PATCH] GetArgv returns null on widnows, do not crash llvm-svn: 259005 --- compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep.cc b/compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep.cc index 9aa7b92..2f4f02f 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep.cc @@ -811,8 +811,10 @@ void CoverageData::DumpOffsets() { InternalMmapVector sancov_argv(module_name_vec.size() + 2); sancov_argv.push_back(FindPathToBinary(common_flags()->sancov_path)); - sancov_argv.push_back(internal_strdup("-obj")); - sancov_argv.push_back(internal_strdup(GetArgv()[0])); + if (GetArgv() != nullptr) { + sancov_argv.push_back(internal_strdup("-obj")); + sancov_argv.push_back(internal_strdup(GetArgv()[0])); + } sancov_argv.push_back(internal_strdup("-html-report")); auto argv_deleter = at_scope_exit([&] { for (uptr i = 0; i < sancov_argv.size(); ++i) { -- 2.7.4