Skip to content

Commit b7dcd5c

Browse files
author
Robert Marsh
authored
Merge pull request #4395 from geoffw0/modelbeginend
C++: Merge StdSequenceContainerBeginEnd into the general BeginOrEndFunction
2 parents 297f1c7 + 1efe461 commit b7dcd5c

File tree

2 files changed

+3
-21
lines changed

2 files changed

+3
-21
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,9 @@ class IteratorArrayMemberOperator extends MemberFunction, TaintFunction, Iterato
280280
*/
281281
class BeginOrEndFunction extends MemberFunction, TaintFunction {
282282
BeginOrEndFunction() {
283-
this.hasName(["begin", "cbegin", "rbegin", "crbegin", "end", "cend", "rend", "crend"]) and
283+
this
284+
.hasName(["begin", "cbegin", "rbegin", "crbegin", "end", "cend", "rend", "crend",
285+
"before_begin", "cbefore_begin"]) and
284286
this.getType().getUnspecifiedType() instanceof Iterator
285287
}
286288

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

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -170,26 +170,6 @@ class StdSequenceContainerAssign extends TaintFunction {
170170
}
171171
}
172172

173-
/**
174-
* The standard container `begin` and `end` functions and their
175-
* variants.
176-
*/
177-
class StdSequenceContainerBeginEnd extends TaintFunction {
178-
StdSequenceContainerBeginEnd() {
179-
this
180-
.hasQualifiedName("std", ["array", "vector", "deque", "list"],
181-
["begin", "cbegin", "rbegin", "crbegin", "end", "cend", "rend", "crend"]) or
182-
this
183-
.hasQualifiedName("std", "forward_list",
184-
["before_begin", "begin", "end", "cbefore_begin", "cbegin", "cend"])
185-
}
186-
187-
override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) {
188-
input.isQualifierObject() and
189-
output.isReturnValue()
190-
}
191-
}
192-
193173
/**
194174
* The standard container `swap` functions.
195175
*/

0 commit comments

Comments
 (0)