buffer overflow: Fix false positive

This commit is contained in:
Daniel Marjamäki 2019-03-11 19:40:17 +01:00
parent bd048085bd
commit 17253cdb55
1 changed files with 2 additions and 0 deletions

View File

@ -291,6 +291,8 @@ size_t CheckBufferOverrun::getBufferSize(const Token *bufTok) const
MathLib::bigint dim = 1; MathLib::bigint dim = 1;
for (const Dimension &d : var->dimensions()) for (const Dimension &d : var->dimensions())
dim *= d.num; dim *= d.num;
if (var->isPointerArray())
return dim * mSettings->sizeof_pointer;
switch (bufTok->valueType()->type) { switch (bufTok->valueType()->type) {
case ValueType::Type::BOOL: case ValueType::Type::BOOL:
return dim * mSettings->sizeof_bool; return dim * mSettings->sizeof_bool;