cert.py: Fix EXP05C crash (#2392)

* cert.py: Fix EXP05 crash

* Fix arguments check
This commit is contained in:
Georgy Komarov 2019-11-23 19:41:47 +03:00 committed by Daniel Marjamäki
parent 1b28fb2d1a
commit 14469aced8
2 changed files with 7 additions and 0 deletions

View File

@ -119,6 +119,8 @@ def exp05(data):
elif token.str == '(' and token.astOperand1 and token.astOperand2 and token.astOperand1.function: elif token.str == '(' and token.astOperand1 and token.astOperand2 and token.astOperand1.function:
function = token.astOperand1.function function = token.astOperand1.function
arguments = cppcheckdata.getArguments(token.previous) arguments = cppcheckdata.getArguments(token.previous)
if not arguments:
continue
for argnr, argvar in function.argument.items(): for argnr, argvar in function.argument.items():
if argnr < 1 or argnr > len(arguments): if argnr < 1 or argnr > len(arguments):
continue continue

View File

@ -8,6 +8,11 @@ public:
static int rand(); static int rand();
}; };
namespace exp05c {
using uint32 = std::uint32_t;
static const uint32 a = static_cast<uint32>(0xFFFFFFFF);
}
void msc30(msc30TestClass & testClass) void msc30(msc30TestClass & testClass)
{ {
unsigned int num = rand(); // cert-MSC30-c unsigned int num = rand(); // cert-MSC30-c