cmssw icon indicating copy to clipboard operation
cmssw copied to clipboard

[ML][Clang]clang-analyzer, initialize memory and add protection against

Open smuzaffar opened this issue 4 months ago • 7 comments

This change fixes clang-analyzer warning with complete report at this link . It is true that we only initialize the tmp memory for first iternumber 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++;

smuzaffar avatar Oct 11 '24 09:10 smuzaffar