Skip to content

Commit ab8d1ea

Browse files
committed
C++: Model ConversionConstructor instead of all Constructors.
1 parent 3f4ebd2 commit ab8d1ea

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

cpp/ql/src/semmle/code/cpp/models/implementations/MemberFunction.qll

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,13 @@ import semmle.code.cpp.models.interfaces.DataFlow
77
import semmle.code.cpp.models.interfaces.Taint
88

99
/**
10-
* Model for C++ constructors (including copy and move constructors).
10+
* Model for C++ conversion constructors.
1111
*/
12-
class ConstructorModel extends Constructor, TaintFunction {
12+
class ConversionConstructorModel extends ConversionConstructor, TaintFunction {
1313
override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) {
14-
// taint flow from any constructor argument to the returned object
15-
exists(int idx |
16-
input.isParameter(idx) and
17-
output.isReturnValue() and
18-
not this.(CopyConstructorModel).hasDataFlow(input, output) and // don't duplicate where we have data flow
19-
not this.(MoveConstructorModel).hasDataFlow(input, output) // don't duplicate where we have data flow
20-
)
14+
// taint flow from the first constructor argument to the returned object
15+
input.isParameter(0) and
16+
output.isReturnValue()
2117
}
2218
}
2319

0 commit comments

Comments
 (0)