@@ -94,6 +94,8 @@ private import FlowSummaryImpl::Public
9494private import FlowSummaryImpl:: Private
9595private import FlowSummaryImpl:: Private:: External
9696private import semmle.code.csharp.commons.QualifiedName
97+ private import semmle.code.csharp.dispatch.OverridableCallable
98+ private import semmle.code.csharp.frameworks.System
9799private import codeql.mad.ModelValidation as SharedModelVal
98100
99101private predicate relevantNamespace ( string namespace ) {
@@ -442,20 +444,16 @@ predicate sourceNode(Node node, string kind) { sourceNode(node, kind, _) }
442444 */
443445predicate sinkNode ( Node node , string kind ) { sinkNode ( node , kind , _) }
444446
445- /** Holds if the summary should apply for all overrides of `c`. */
446- predicate isBaseCallableOrPrototype ( UnboundCallable c ) {
447- c .getDeclaringType ( ) instanceof Interface
448- or
449- exists ( Modifiable m | m = [ c .( Modifiable ) , c .( Accessor ) .getDeclaration ( ) ] |
450- m .isAbstract ( )
451- or
452- c .getDeclaringType ( ) .( Modifiable ) .isAbstract ( ) and m .( Virtualizable ) .isVirtual ( )
447+ private predicate isOverridableCallable ( OverridableCallable c ) {
448+ not exists ( Type t , Callable base | c .getOverridee + ( ) = base and t = base .getDeclaringType ( ) |
449+ t instanceof SystemObjectClass or
450+ t instanceof SystemValueTypeClass
453451 )
454452}
455453
456454/** Gets a string representing whether the summary should apply for all overrides of `c`. */
457455private string getCallableOverride ( UnboundCallable c ) {
458- if isBaseCallableOrPrototype ( c ) then result = "true" else result = "false"
456+ if isOverridableCallable ( c ) then result = "true" else result = "false"
459457}
460458
461459private module QualifiedNameInput implements QualifiedNameInputSig {
0 commit comments