aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Instrumentation
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2011-12-13 19:34:53 +0000
committerKostya Serebryany <kcc@google.com>2011-12-13 19:34:53 +0000
commit085cb8f0b957841ab667a46be0c49ce4ee8c9c79 (patch)
tree9c37b239b69c650553d7f5575769f8a5e30f6c34 /lib/Transforms/Instrumentation
parent8a9bce978fa4ca60d3a0ba42a1d44c41463a3c33 (diff)
downloadexternal_llvm-085cb8f0b957841ab667a46be0c49ce4ee8c9c79.zip
external_llvm-085cb8f0b957841ab667a46be0c49ce4ee8c9c79.tar.gz
external_llvm-085cb8f0b957841ab667a46be0c49ce4ee8c9c79.tar.bz2
[asan] report an error if blacklist file contains a malformed regex. fixes asan issue 17
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146503 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Instrumentation')
-rw-r--r--lib/Transforms/Instrumentation/AddressSanitizer.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index f16bdf5..f170cf1 100644
--- a/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -979,15 +979,23 @@ BlackList::BlackList(const std::string &Path) {
for (size_t i = 0, numLines = Lines.size(); i < numLines; i++) {
if (Lines[i].startswith(kFunPrefix)) {
std::string ThisFunc = Lines[i].substr(strlen(kFunPrefix));
- if (Fun.size()) {
- Fun += "|";
- }
+ std::string ThisFuncRE;
// add ThisFunc replacing * with .*
for (size_t j = 0, n = ThisFunc.size(); j < n; j++) {
if (ThisFunc[j] == '*')
- Fun += '.';
- Fun += ThisFunc[j];
+ ThisFuncRE += '.';
+ ThisFuncRE += ThisFunc[j];
}
+ // Check that the regexp is valid.
+ Regex CheckRE(ThisFuncRE);
+ std::string Error;
+ if (!CheckRE.isValid(Error))
+ report_fatal_error("malformed blacklist regex: " + ThisFunc +
+ ": " + Error);
+ // Append to the final regexp.
+ if (Fun.size())
+ Fun += "|";
+ Fun += ThisFuncRE;
}
}
if (Fun.size()) {