Skip to content

Commit b5bd734

Browse files
Update checkbufferoverrun.cpp
1 parent 4233c6c commit b5bd734

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

lib/checkbufferoverrun.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -556,14 +556,15 @@ ValueFlow::Value CheckBufferOverrunImpl::getBufferSize(const Token *bufTok) cons
556556
{
557557
if (!bufTok->valueType())
558558
return ValueFlow::Value(-1);
559-
if (bufTok->isUnaryOp("&"))
560-
bufTok = bufTok->astOperand1();
561559
const Token* varTok = bufTok;
562-
if (Token::simpleMatch(bufTok, "[")) {
563-
const Token* index = bufTok->astOperand2();
564-
if (!(index && index->hasKnownIntValue() && index->getKnownIntValue() == 0))
565-
return ValueFlow::Value(-1);
566-
varTok = varTok->astOperand1();
560+
if (bufTok->isUnaryOp("&")) {
561+
bufTok = bufTok->astOperand1();
562+
if (Token::simpleMatch(bufTok, "[")) {
563+
const Token* index = bufTok->astOperand2();
564+
if (!(index && index->hasKnownIntValue() && index->getKnownIntValue() == 0))
565+
return ValueFlow::Value(-1);
566+
varTok = bufTok->astOperand1();
567+
}
567568
}
568569
const Variable *var = varTok->variable();
569570

0 commit comments

Comments
 (0)