mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
[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
This commit is contained in:
@@ -979,15 +979,23 @@ BlackList::BlackList(const std::string &Path) {
|
|||||||
for (size_t i = 0, numLines = Lines.size(); i < numLines; i++) {
|
for (size_t i = 0, numLines = Lines.size(); i < numLines; i++) {
|
||||||
if (Lines[i].startswith(kFunPrefix)) {
|
if (Lines[i].startswith(kFunPrefix)) {
|
||||||
std::string ThisFunc = Lines[i].substr(strlen(kFunPrefix));
|
std::string ThisFunc = Lines[i].substr(strlen(kFunPrefix));
|
||||||
if (Fun.size()) {
|
std::string ThisFuncRE;
|
||||||
Fun += "|";
|
|
||||||
}
|
|
||||||
// add ThisFunc replacing * with .*
|
// add ThisFunc replacing * with .*
|
||||||
for (size_t j = 0, n = ThisFunc.size(); j < n; j++) {
|
for (size_t j = 0, n = ThisFunc.size(); j < n; j++) {
|
||||||
if (ThisFunc[j] == '*')
|
if (ThisFunc[j] == '*')
|
||||||
Fun += '.';
|
ThisFuncRE += '.';
|
||||||
Fun += ThisFunc[j];
|
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()) {
|
if (Fun.size()) {
|
||||||
|
Reference in New Issue
Block a user