MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / isVLAIndex

Function isVLAIndex

lib/checkbufferoverrun.cpp:1155–1169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1153}
1154
1155static bool isVLAIndex(const Token* tok)
1156{
1157 if (!tok)
1158 return false;
1159 if (tok->varId() != 0U)
1160 return true;
1161 if (tok->str() == "?") {
1162 // this is a VLA index if both expressions around the ":" is VLA index
1163 return tok->astOperand2() &&
1164 tok->astOperand2()->str() == ":" &&
1165 isVLAIndex(tok->astOperand2()->astOperand1()) &&
1166 isVLAIndex(tok->astOperand2()->astOperand2());
1167 }
1168 return isVLAIndex(tok->astOperand1()) || isVLAIndex(tok->astOperand2());
1169}
1170
1171void CheckBufferOverrunImpl::negativeArraySize()
1172{

Callers 1

negativeArraySizeMethod · 0.85

Calls 3

astOperand2Method · 0.80
astOperand1Method · 0.80
strMethod · 0.45

Tested by

no test coverage detected