cmssw
cmssw copied to clipboard
[ML][Clang]clang-analyzer, initialize memory and add protection against
This change fixes clang-analyzer warning with complete report at this link . It is true that we only initialize the tmp
memory for first iter
number of items.
This Pr replaces alloca
with calloc
which should initialize the memory to 0
and also adds protection to make sure that maxTmp
is greater than the layer's inputs (otherwise input[j]
can access out of range memory)
src/PhysicsTools/MVAComputer/src/ProcMLP.cc:117:27: warning: The left operand of '*' is a garbage value [core.UndefinedBinaryOperatorResult]
117 | sum += input[j] * *coeff++;