Try to fix issue 9341: daca crash: isContainerSizeChangedByFunction (#2168)

This commit is contained in:
Paul Fultz II 2019-09-10 12:39:44 -05:00 committed by Daniel Marjamäki
parent da29a1f56b
commit ddb1f1b5ce
1 changed files with 12 additions and 10 deletions

View File

@ -5322,17 +5322,19 @@ static bool isContainerSizeChangedByFunction(const Token *tok, int depth = 20)
const Function * fun = ftok->function(); const Function * fun = ftok->function();
if (fun) { if (fun) {
const Variable *arg = fun->getArgumentVar(narg); const Variable *arg = fun->getArgumentVar(narg);
if (!arg->isReference() && !addressOf) if (arg) {
return false; if (!arg->isReference() && !addressOf)
if (arg->isConst())
return false;
const Scope * scope = fun->functionScope;
if (scope) {
// Argument not used
if (!arg->nameToken())
return false; return false;
if (depth > 0) if (arg->isConst())
return isContainerSizeChanged(arg->declarationId(), scope->bodyStart, scope->bodyEnd, depth - 1); return false;
const Scope * scope = fun->functionScope;
if (scope) {
// Argument not used
if (!arg->nameToken())
return false;
if (depth > 0)
return isContainerSizeChanged(arg->declarationId(), scope->bodyStart, scope->bodyEnd, depth - 1);
}
} }
} }