diff --git a/csharp/ql/lib/semmle/code/csharp/commons/QualifiedName.qll b/csharp/ql/lib/semmle/code/csharp/commons/QualifiedName.qll index 2af02f3e85f..6fef9cc2457 100644 --- a/csharp/ql/lib/semmle/code/csharp/commons/QualifiedName.qll +++ b/csharp/ql/lib/semmle/code/csharp/commons/QualifiedName.qll @@ -67,6 +67,12 @@ module QualifiedName { ) } + private string getName(ValueOrRefType t) { + not t instanceof ExtensionType and result = t.getUndecoratedName() + or + result = "extension(" + getFullName(t.(ExtensionType).getExtendedType()) + ")" + } + /** Holds if declaration `d` has the qualified name `qualifier`.`name`. */ predicate hasQualifiedName(Declaration d, string qualifier, string name) { d = @@ -86,12 +92,12 @@ module QualifiedName { exists(string name0 | name = name0 + Input::getUnboundGenericSuffix(ugt) | exists(string enclosing | hasQualifiedName(ugt.getDeclaringType(), qualifier, enclosing) and - name0 = enclosing + "+" + ugt.getUndecoratedName() + name0 = enclosing + "+" + getName(ugt) ) or not exists(ugt.getDeclaringType()) and qualifier = ugt.getNamespace().getFullName() and - name0 = ugt.getUndecoratedName() + name0 = getName(ugt) ) ) or @@ -100,12 +106,12 @@ module QualifiedName { exists(string name0 | name = name0 + "<" + getTypeArgumentsQualifiedNames(ct) + ">" | exists(string enclosing | hasQualifiedName(ct.getDeclaringType(), qualifier, enclosing) and - name0 = enclosing + "+" + ct.getUndecoratedName() + name0 = enclosing + "+" + getName(ct) ) or not exists(ct.getDeclaringType()) and qualifier = ct.getNamespace().getFullName() and - name0 = ct.getUndecoratedName() + name0 = getName(ct) ) ) or @@ -116,12 +122,12 @@ module QualifiedName { ( exists(string enclosing | hasQualifiedName(vort.getDeclaringType(), qualifier, enclosing) and - name = enclosing + "+" + vort.getUndecoratedName() + name = enclosing + "+" + getName(vort) ) or not exists(vort.getDeclaringType()) and qualifier = vort.getNamespace().getFullName() and - name = vort.getUndecoratedName() + name = getName(vort) ) ) or diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/ExternalFlow.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/ExternalFlow.qll index d358c4aa441..edfaae018e9 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/ExternalFlow.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/ExternalFlow.qll @@ -214,7 +214,7 @@ module ModelValidation { not namespace.regexpMatch("[a-zA-Z0-9_\\.]+") and result = "Dubious namespace \"" + namespace + "\" in " + pred + " model." or - not type.regexpMatch("[a-zA-Z0-9_<>,\\(\\)\\+]+") and + not type.regexpMatch("[a-zA-Z0-9_<>,\\(\\)\\+\\.]+") and result = "Dubious type \"" + type + "\" in " + pred + " model." or not name.regexpMatch("[a-zA-Z0-9_<>,\\.]*") and