In scene1, cppcheck reports an error : Address of local auto-variable assigned to a function parameter. [autoVariables].
In scene2, 3, 4, cppcheck reports no error.
From source code, I found you use exhaustive attack method to detect such problem. Is there a better method ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
From source code, I found you use exhaustive attack method to detect such problem. Is there a better method ?
I have the feeling that this check is ~10 years old. So it's likely that it can be refactored and made more effective.
I don't remember off the top of my head exactly how this checker works. But checking for the assignment itself should be done using the AST/SymbolDatabase. Then checking that the address does not "leak" could be checked by FwdAnalysis... if something can be added in FwdAnalysis that replaces CheckLeakAutoVar and CheckMemoryLeak that would be pretty cool.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In scene1, cppcheck reports an error : Address of local auto-variable assigned to a function parameter. [autoVariables].
In scene2, 3, 4, cppcheck reports no error.
From source code, I found you use exhaustive attack method to detect such problem. Is there a better method ?
Thanks! I created ticket https://trac.cppcheck.net/ticket/9831
I have the feeling that this check is ~10 years old. So it's likely that it can be refactored and made more effective.
I don't remember off the top of my head exactly how this checker works. But checking for the assignment itself should be done using the AST/SymbolDatabase. Then checking that the address does not "leak" could be checked by FwdAnalysis... if something can be added in FwdAnalysis that replaces CheckLeakAutoVar and CheckMemoryLeak that would be pretty cool.