summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
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
commit21dc2be97a33129f4b6a5b6baa4300a0eee2cd52 (patch)
tree57609e8df7e08f2b706d43625c712d07e72f0297 /llvm/lib/Transforms
parent563de603f71d88cc71a42d5ba79234e7112879a5 (diff)
downloadbcm5719-llvm-21dc2be97a33129f4b6a5b6baa4300a0eee2cd52.tar.gz
bcm5719-llvm-21dc2be97a33129f4b6a5b6baa4300a0eee2cd52.zip
[asan] report an error if blacklist file contains a malformed regex. fixes asan issue 17
llvm-svn: 146503
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index f16bdf530c5..f170cf150ab 100644
--- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/llvm/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()) {
OpenPOWER on IntegriCloud