C++: Make implicit this receivers explicit

This commit is contained in:
Kasper Svendsen
2023-05-09 13:15:54 +02:00
parent ffa30284ea
commit c46898cb75
68 changed files with 589 additions and 560 deletions

View File

@@ -38,7 +38,7 @@ class ExternalApiUsedWithUntrustedData extends TExternalApi {
/** Gets the number of untrusted sources used with this external API. */
int getNumberOfUntrustedSources() {
result = strictcount(getUntrustedDataNode().getAnUntrustedSource())
result = strictcount(this.getUntrustedDataNode().getAnUntrustedSource())
}
/** Gets a textual representation of this element. */

View File

@@ -38,7 +38,7 @@ class ExternalApiUsedWithUntrustedData extends TExternalApi {
/** Gets the number of untrusted sources used with this external API. */
int getNumberOfUntrustedSources() {
result = strictcount(getUntrustedDataNode().getAnUntrustedSource())
result = strictcount(this.getUntrustedDataNode().getAnUntrustedSource())
}
/** Gets a textual representation of this element. */

View File

@@ -19,14 +19,14 @@ import TaintedWithPath
/** A call that prints its arguments to `stdout`. */
class PrintStdoutCall extends FunctionCall {
PrintStdoutCall() {
getTarget().hasGlobalOrStdName("puts") or
getTarget().hasGlobalOrStdName("printf")
this.getTarget().hasGlobalOrStdName("puts") or
this.getTarget().hasGlobalOrStdName("printf")
}
}
/** A read of the QUERY_STRING environment variable */
class QueryString extends EnvironmentRead {
QueryString() { getEnvironmentVariable() = "QUERY_STRING" }
QueryString() { this.getEnvironmentVariable() = "QUERY_STRING" }
}
class Configuration extends TaintTrackingConfiguration {

View File

@@ -18,7 +18,7 @@ import semmle.code.cpp.ir.dataflow.DataFlow
* A call to `SSL_get_verify_result`.
*/
class SslGetVerifyResultCall extends FunctionCall {
SslGetVerifyResultCall() { getTarget().getName() = "SSL_get_verify_result" }
SslGetVerifyResultCall() { this.getTarget().getName() = "SSL_get_verify_result" }
}
/**

View File

@@ -19,10 +19,10 @@ import semmle.code.cpp.controlflow.IRGuards
*/
class SslGetPeerCertificateCall extends FunctionCall {
SslGetPeerCertificateCall() {
getTarget().getName() = "SSL_get_peer_certificate" // SSL_get_peer_certificate(ssl)
this.getTarget().getName() = "SSL_get_peer_certificate" // SSL_get_peer_certificate(ssl)
}
Expr getSslArgument() { result = getArgument(0) }
Expr getSslArgument() { result = this.getArgument(0) }
}
/**
@@ -30,10 +30,10 @@ class SslGetPeerCertificateCall extends FunctionCall {
*/
class SslGetVerifyResultCall extends FunctionCall {
SslGetVerifyResultCall() {
getTarget().getName() = "SSL_get_verify_result" // SSL_get_peer_certificate(ssl)
this.getTarget().getName() = "SSL_get_verify_result" // SSL_get_peer_certificate(ssl)
}
Expr getSslArgument() { result = getArgument(0) }
Expr getSslArgument() { result = this.getArgument(0) }
}
/**

View File

@@ -150,7 +150,7 @@ class BlamedElement extends Element {
*/
predicate hasFileRank(File f, int num) {
exists(int loc |
getLocation().charLoc(f, loc, _) and
this.getLocation().charLoc(f, loc, _) and
loc =
rank[num](BlamedElement other, int loc2 | other.getLocation().charLoc(f, loc2, _) | loc2)
)