C++: Improve dataflow model for copy/move constructors

This commit is contained in:
Dave Bartolomeo
2020-10-16 16:55:59 -04:00
parent 9afddf0dad
commit cf19fcf4c0

View File

@@ -35,7 +35,11 @@ class ConversionConstructorModel extends Constructor, TaintFunction {
class CopyConstructorModel extends CopyConstructor, DataFlowFunction {
override predicate hasDataFlow(FunctionInput input, FunctionOutput output) {
// data flow from the first constructor argument to the returned object
input.isParameter(0) and
(
input.isParameter(0)
or
input.isParameterDeref(0)
) and
(
output.isReturnValue()
or
@@ -50,7 +54,11 @@ class CopyConstructorModel extends CopyConstructor, DataFlowFunction {
class MoveConstructorModel extends MoveConstructor, DataFlowFunction {
override predicate hasDataFlow(FunctionInput input, FunctionOutput output) {
// data flow from the first constructor argument to the returned object
input.isParameter(0) and
(
input.isParameter(0)
or
input.isParameterDeref(0)
) and
(
output.isReturnValue()
or