mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
C#: Do not assume that extension methods on nullable types do unsafe dereference.
This commit is contained in:
@@ -544,8 +544,13 @@ class Dereference extends G::DereferenceableExpr {
|
||||
p.hasExtensionMethodModifier() and
|
||||
not emc.isConditional()
|
||||
|
|
||||
p.fromSource() // assume all non-source extension methods perform a dereference
|
||||
implies
|
||||
// Assume all non-source extension methods on
|
||||
// (1) nullable types are null-safe
|
||||
// (2) non-nullable types are doing a dereference.
|
||||
p.fromLibrary() and
|
||||
not p.getAnnotatedType().isNullableRefType()
|
||||
or
|
||||
p.fromSource() and
|
||||
exists(
|
||||
Ssa::ImplicitParameterDefinition def,
|
||||
AssignableDefinitions::ImplicitParameterDefinition pdef
|
||||
|
||||
Reference in New Issue
Block a user