[llvm-commits] [llvm] r146503 - /llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
Kostya Serebryany
kcc at google.com
Tue Dec 13 11:34:53 PST 2011
Author: kcc
Date: Tue Dec 13 13:34:53 2011
New Revision: 146503
URL: http://llvm.org/viewvc/llvm-project?rev=146503&view=rev
Log:
[asan] report an error if blacklist file contains a malformed regex. fixes asan issue 17
Modified:
llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
Modified: llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp?rev=146503&r1=146502&r2=146503&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp Tue Dec 13 13:34:53 2011
@@ -979,15 +979,23 @@
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()) {
More information about the llvm-commits
mailing list