Preprocessor:removeParentheses: fixed potential buffer access out of bounds, if find returns std::string::npos.
This commit is contained in:
parent
4e7594748d
commit
4fbe15c866
|
@ -819,9 +819,12 @@ std::string Preprocessor::removeParentheses(const std::string &str)
|
|||
--ind;
|
||||
if (ind == 0) {
|
||||
if (i == line.length() - 1) {
|
||||
line[line.find('(')] = ' ';
|
||||
const std::string::size_type posIndx = line.find('(');
|
||||
if (posIndx != std::string::npos) {
|
||||
line[posIndx] = ' ';
|
||||
line.erase(line.length() - 1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue