Skip to content

Commit 28d5ef9

Browse files
authored
Merge pull request github#5158 from geoffw0/modelsbsl3
C++: StdString BSL support
2 parents 8f5fe14 + 6d45252 commit 28d5ef9

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import semmle.code.cpp.models.interfaces.DataFlow
1212
* The `std::basic_string` template class instantiations.
1313
*/
1414
private class StdBasicString extends ClassTemplateInstantiation {
15-
StdBasicString() { this.hasQualifiedName("std", "basic_string") }
15+
StdBasicString() { this.hasQualifiedName(["std", "bsl"], "basic_string") }
1616
}
1717

1818
/**
@@ -127,7 +127,7 @@ private class StdStringFrontBack extends TaintFunction {
127127
*/
128128
private class StdStringPlus extends TaintFunction {
129129
StdStringPlus() {
130-
this.hasQualifiedName("std", "operator+") and
130+
this.hasQualifiedName(["std", "bsl"], "operator+") and
131131
this.getUnspecifiedType() instanceof StdBasicString
132132
}
133133

@@ -252,13 +252,6 @@ private class StdStringSubstr extends TaintFunction {
252252
}
253253
}
254254

255-
/**
256-
* The `std::basic_stringstream` template class instantiations.
257-
*/
258-
private class StdBasicStringStream extends ClassTemplateInstantiation {
259-
StdBasicStringStream() { this.hasQualifiedName("std", "basic_stringstream") }
260-
}
261-
262255
/**
263256
* The `std::string` functions `at` and `operator[]`.
264257
*/
@@ -280,7 +273,7 @@ private class StdStringAt extends TaintFunction {
280273
* The `std::basic_istream` template class instantiations.
281274
*/
282275
private class StdBasicIStream extends ClassTemplateInstantiation {
283-
StdBasicIStream() { this.hasQualifiedName("std", "basic_istream") }
276+
StdBasicIStream() { this.hasQualifiedName(["std", "bsl"], "basic_istream") }
284277
}
285278

286279
/**
@@ -314,7 +307,7 @@ private class StdIStreamIn extends DataFlowFunction, TaintFunction {
314307
*/
315308
private class StdIStreamInNonMember extends DataFlowFunction, TaintFunction {
316309
StdIStreamInNonMember() {
317-
this.hasQualifiedName("std", "operator>>") and
310+
this.hasQualifiedName(["std", "bsl"], "operator>>") and
318311
this.getUnspecifiedType().(ReferenceType).getBaseType() instanceof StdBasicIStream
319312
}
320313

@@ -462,7 +455,7 @@ private class StdIStreamGetLine extends DataFlowFunction, TaintFunction {
462455
* The (non-member) function `std::getline`.
463456
*/
464457
private class StdGetLine extends DataFlowFunction, TaintFunction {
465-
StdGetLine() { this.hasQualifiedName("std", "getline") }
458+
StdGetLine() { this.hasQualifiedName(["std", "bsl"], "getline") }
466459

467460
override predicate hasDataFlow(FunctionInput input, FunctionOutput output) {
468461
// flow from first parameter to return value
@@ -488,7 +481,7 @@ private class StdGetLine extends DataFlowFunction, TaintFunction {
488481
* The `std::basic_ostream` template class instantiations.
489482
*/
490483
private class StdBasicOStream extends ClassTemplateInstantiation {
491-
StdBasicOStream() { this.hasQualifiedName("std", "basic_ostream") }
484+
StdBasicOStream() { this.hasQualifiedName(["std", "bsl"], "basic_ostream") }
492485
}
493486

494487
/**
@@ -535,7 +528,7 @@ private class StdOStreamOut extends DataFlowFunction, TaintFunction {
535528
*/
536529
private class StdOStreamOutNonMember extends DataFlowFunction, TaintFunction {
537530
StdOStreamOutNonMember() {
538-
this.hasQualifiedName("std", "operator<<") and
531+
this.hasQualifiedName(["std", "bsl"], "operator<<") and
539532
this.getUnspecifiedType().(ReferenceType).getBaseType() instanceof StdBasicOStream
540533
}
541534

@@ -563,6 +556,13 @@ private class StdOStreamOutNonMember extends DataFlowFunction, TaintFunction {
563556
}
564557
}
565558

559+
/**
560+
* The `std::basic_stringstream` template class instantiations.
561+
*/
562+
private class StdBasicStringStream extends ClassTemplateInstantiation {
563+
StdBasicStringStream() { this.hasQualifiedName(["std", "bsl"], "basic_stringstream") }
564+
}
565+
566566
/**
567567
* Additional model for `std::stringstream` constructors that take a string
568568
* input parameter.
@@ -609,7 +609,7 @@ private class StdStringStreamStr extends TaintFunction {
609609
* The `std::basic_ios` template class instantiations.
610610
*/
611611
private class StdBasicIOS extends ClassTemplateInstantiation {
612-
StdBasicIOS() { this.hasQualifiedName("std", "basic_ios") }
612+
StdBasicIOS() { this.hasQualifiedName(["std", "bsl"], "basic_ios") }
613613
}
614614

615615
/**

0 commit comments

Comments
 (0)