Skip to content

Commit db2457c

Browse files
Update checkbufferoverrun.cpp
1 parent ac061da commit db2457c

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

lib/checkbufferoverrun.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,8 +1088,12 @@ void CheckBufferOverrunImpl::objectIndex()
10881088
for (const ValueFlow::Value& v:values) {
10891089
if (v.lifetimeKind != ValueFlow::Value::LifetimeKind::Address && v.lifetimeKind != ValueFlow::Value::LifetimeKind::Object)
10901090
continue;
1091-
const Token* varTok = nextAfterAstRightmostLeaf(v.tokvalue->astParent());
1092-
varTok = varTok ? varTok->previous() : nullptr;
1091+
const Token* varTok = v.tokvalue;
1092+
if (Token::simpleMatch(varTok->astParent(), ".")) {
1093+
varTok = varTok->astParent();
1094+
while (Token::simpleMatch(varTok, "."))
1095+
varTok = varTok->astOperand2();
1096+
}
10931097
const Variable *var = varTok ? varTok->variable() : nullptr;
10941098
if (!var)
10951099
continue;

0 commit comments

Comments
 (0)