Skip to content

Commit b37c220

Browse files
Update checkbufferoverrun.cpp
1 parent 86f4c91 commit b37c220

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

lib/checkbufferoverrun.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,9 +1086,11 @@ void CheckBufferOverrunImpl::objectIndex()
10861086

10871087
std::vector<ValueFlow::Value> values = ValueFlow::getLifetimeObjValues(obj, false, -1);
10881088
for (const ValueFlow::Value& v:values) {
1089-
if (v.lifetimeKind != ValueFlow::Value::LifetimeKind::Address)
1089+
if (v.lifetimeKind != ValueFlow::Value::LifetimeKind::Address && v.lifetimeKind != ValueFlow::Value::LifetimeKind::Object)
10901090
continue;
1091-
const Variable *var = v.tokvalue->variable();
1091+
const Token* varTok = nextAfterAstRightmostLeaf(v.tokvalue->astParent());
1092+
varTok = varTok ? varTok->previous() : nullptr;
1093+
const Variable *var = varTok ? varTok->variable() : nullptr;
10921094
if (!var)
10931095
continue;
10941096
if (var->isReference())

0 commit comments

Comments
 (0)