Skip to content

Commit 071b303

Browse files
committed
C++: Make the other versions consistent with this.
1 parent 865d91d commit 071b303

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class StdSequenceContainerConstructor extends Constructor, TaintFunction {
2323
*/
2424
int getAValueTypeParameterIndex() {
2525
getParameter(result).getUnspecifiedType().(ReferenceType).getBaseType() =
26-
getDeclaringType().getTemplateArgument(0) // i.e. the `T` of this `std::vector<T>`
26+
getDeclaringType().getTemplateArgument(0).(Type).getUnspecifiedType() // i.e. the `T` of this `std::vector<T>`
2727
}
2828

2929
override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) {

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,17 @@ class StdStringAppend extends TaintFunction {
7171
* Gets the index of a parameter to this function that is a string (or
7272
* character).
7373
*/
74-
int getAStringParameter() {
74+
int getAStringParameterIndex() {
7575
getParameter(result).getType() instanceof PointerType or
7676
getParameter(result).getType() instanceof ReferenceType or
77-
getParameter(result).getType() = getDeclaringType().getTemplateArgument(0) // i.e. `std::basic_string::CharT`
77+
getParameter(result).getUnspecifiedType() = getDeclaringType().getTemplateArgument(0).(Type).getUnspecifiedType() // i.e. `std::basic_string::CharT`
7878
}
7979

8080
override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) {
8181
// flow from string and parameter to string (qualifier) and return value
8282
(
8383
input.isQualifierObject() or
84-
input.isParameterDeref(getAStringParameter())
84+
input.isParameterDeref(getAStringParameterIndex())
8585
) and
8686
(
8787
output.isQualifierObject() or
@@ -100,15 +100,15 @@ class StdStringAssign extends TaintFunction {
100100
* Gets the index of a parameter to this function that is a string (or
101101
* character).
102102
*/
103-
int getAStringParameter() {
103+
int getAStringParameterIndex() {
104104
getParameter(result).getType() instanceof PointerType or
105105
getParameter(result).getType() instanceof ReferenceType or
106-
getParameter(result).getType() = getDeclaringType().getTemplateArgument(0) // i.e. `std::basic_string::CharT`
106+
getParameter(result).getUnspecifiedType() = getDeclaringType().getTemplateArgument(0).(Type).getUnspecifiedType() // i.e. `std::basic_string::CharT`
107107
}
108108

109109
override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) {
110110
// flow from parameter to string itself (qualifier) and return value
111-
input.isParameterDeref(getAStringParameter()) and
111+
input.isParameterDeref(getAStringParameterIndex()) and
112112
(
113113
output.isQualifierObject() or
114114
output.isReturnValueDeref()

0 commit comments

Comments
 (0)