You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @description An object larger than 64 bytes is passed by value to a function. Passing large objects by value unnecessarily use up scarce stack space, increase the cost of calling a function and can be a security risk. Use a const pointer to the object instead.
* @kind problem
* @problem.severity recommendation
* @precision very-high
* @id cpp/large-parameter
* @tags efficiency
* readability
* statistical
* non-attributable
*/
import cpp
import semmle.code.cpp.dataflow.EscapesTree
fromFunctionf,Parameterp,Typet,intsize
where
f.getAParameter()=pand
p.getType()=tand
t.getSize()=sizeand
size>64and
nott.getUnderlyingType()instanceofArrayTypeand
notfinstanceofCopyAssignmentOperatorand
// exception: p is written to, which may mean the copy is intended