mirror of
https://github.com/github/codeql.git
synced 2026-04-24 16:25:15 +02:00
Rust: Use DerefExpr.
This commit is contained in:
@@ -610,7 +610,7 @@ module Impl {
|
||||
exists(Expr mid |
|
||||
assignmentExprDescendant(mid) and
|
||||
getImmediateParent(e) = mid and
|
||||
not mid.(PrefixExpr).getOperatorName() = "*" and
|
||||
not mid instanceof DerefExpr and
|
||||
not mid instanceof FieldExpr and
|
||||
not mid instanceof IndexExpr
|
||||
)
|
||||
|
||||
@@ -259,8 +259,7 @@ private predicate typeEqualityLeft(AstNode n1, TypePath path1, AstNode n2, TypeP
|
||||
typeEquality(n1, path1, n2, path2)
|
||||
or
|
||||
n2 =
|
||||
any(PrefixExpr pe |
|
||||
pe.getOperatorName() = "*" and
|
||||
any(DerefExpr pe |
|
||||
pe.getExpr() = n1 and
|
||||
path1.isCons(TRefTypeParameter(), path2)
|
||||
)
|
||||
@@ -271,8 +270,7 @@ private predicate typeEqualityRight(AstNode n1, TypePath path1, AstNode n2, Type
|
||||
typeEquality(n1, path1, n2, path2)
|
||||
or
|
||||
n2 =
|
||||
any(PrefixExpr pe |
|
||||
pe.getOperatorName() = "*" and
|
||||
any(DerefExpr pe |
|
||||
pe.getExpr() = n1 and
|
||||
path1 = TypePath::cons(TRefTypeParameter(), path2)
|
||||
)
|
||||
|
||||
@@ -50,9 +50,7 @@ module AccessInvalidPointer {
|
||||
* A pointer access using the unary `*` operator.
|
||||
*/
|
||||
private class DereferenceSink extends Sink {
|
||||
DereferenceSink() {
|
||||
exists(PrefixExpr p | p.getOperatorName() = "*" and p.getExpr() = this.asExpr().getExpr())
|
||||
}
|
||||
DereferenceSink() { exists(DerefExpr p | p.getExpr() = this.asExpr().getExpr()) }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user