[Analyzer] Check function name size before indexing.

https://reviews.llvm.org/D37908

llvm-svn: 313385
This commit is contained in:
George Karpenkov 2017-09-15 19:51:26 +00:00
parent 457fb0b4a0
commit e28adb4fb2
2 changed files with 4 additions and 1 deletions

View File

@ -1211,7 +1211,8 @@ RetainSummaryManager::getFunctionSummary(const FunctionDecl *FD) {
// Check for release functions, the only kind of functions that we care
// about that don't return a pointer type.
if (FName[0] == 'C' && (FName[1] == 'F' || FName[1] == 'G')) {
if (FName.size() >= 2 &&
FName[0] == 'C' && (FName[1] == 'F' || FName[1] == 'G')) {
// Test for 'CGCF'.
FName = FName.substr(FName.startswith("CGCF") ? 4 : 2);

View File

@ -461,3 +461,5 @@ void radar13722286::PrepareBitmap() {
}
}
// rdar://34210609
void _() { _(); }; // no-warning