@@ -6,6 +6,7 @@ private import csharp as CS
6
6
private import semmle.code.csharp.commons.Util as Util
7
7
private import semmle.code.csharp.commons.Collections as Collections
8
8
private import semmle.code.csharp.dataflow.internal.DataFlowDispatch
9
+ private import semmle.code.csharp.frameworks.System as System
9
10
import semmle.code.csharp.dataflow.ExternalFlow as ExternalFlow
10
11
import semmle.code.csharp.dataflow.internal.DataFlowImplCommon as DataFlowImplCommon
11
12
import semmle.code.csharp.dataflow.internal.DataFlowPrivate as DataFlowPrivate
@@ -16,14 +17,25 @@ module TaintTracking = CS::TaintTracking;
16
17
17
18
class Type = CS:: Type ;
18
19
20
+ /**
21
+ * Holds if `api` is an override of `GetHashCode` or `Equals`.
22
+ */
23
+ private predicate isIrrellevantObjectOveride ( CS:: Callable api ) {
24
+ exists ( System:: SystemObjectClass c |
25
+ api = c .getGetHashCodeMethod ( ) .getAnOverrider * ( ) or
26
+ api = c .getEqualsMethod ( ) .getAnOverrider * ( )
27
+ )
28
+ }
29
+
19
30
/**
20
31
* Holds if it is relevant to generate models for `api`.
21
32
*/
22
33
private predicate isRelevantForModels ( CS:: Callable api ) {
23
34
[ api .( CS:: Modifiable ) , api .( CS:: Accessor ) .getDeclaration ( ) ] .isEffectivelyPublic ( ) and
35
+ api .getDeclaringType ( ) .getNamespace ( ) .getQualifiedName ( ) != "" and
24
36
not api instanceof CS:: ConversionOperator and
25
37
not api instanceof Util:: MainMethod and
26
- api . getDeclaringType ( ) . getNamespace ( ) . getQualifiedName ( ) != ""
38
+ not isIrrellevantObjectOveride ( api )
27
39
}
28
40
29
41
/**
0 commit comments