mirror of
https://github.com/github/codeql.git
synced 2026-05-10 17:29:26 +02:00
CPP: Model taint flow through std::swap.
This commit is contained in:
@@ -6,3 +6,4 @@ private import implementations.Pure
|
||||
private import implementations.Strcat
|
||||
private import implementations.Strcpy
|
||||
private import implementations.Strftime
|
||||
private import implementations.Swap
|
||||
|
||||
23
cpp/ql/src/semmle/code/cpp/models/implementations/Swap.qll
Normal file
23
cpp/ql/src/semmle/code/cpp/models/implementations/Swap.qll
Normal file
@@ -0,0 +1,23 @@
|
||||
import semmle.code.cpp.models.interfaces.DataFlow
|
||||
import semmle.code.cpp.models.interfaces.Taint
|
||||
|
||||
/**
|
||||
* The standard function `swap`.
|
||||
*/
|
||||
class Swap extends DataFlowFunction {
|
||||
Swap() {
|
||||
this.hasQualifiedName("std", "swap")
|
||||
}
|
||||
|
||||
override predicate hasDataFlow(FunctionInput input, FunctionOutput output) {
|
||||
(
|
||||
input.isInParameterPointer(0) and
|
||||
output.isOutParameterPointer(1)
|
||||
)
|
||||
or
|
||||
(
|
||||
input.isInParameterPointer(1) and
|
||||
output.isOutParameterPointer(0)
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user