From a991afdf697a11f28e8bd2230b3da01897ca03cd Mon Sep 17 00:00:00 2001 From: Michael Nebel Date: Wed, 7 Jan 2026 09:55:10 +0100 Subject: [PATCH] C#: Use ref conversions (including variance conversions) for element types of span conversions. --- csharp/ql/lib/semmle/code/csharp/Conversion.qll | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/csharp/ql/lib/semmle/code/csharp/Conversion.qll b/csharp/ql/lib/semmle/code/csharp/Conversion.qll index e9222c469a7..ec7ef9cac95 100644 --- a/csharp/ql/lib/semmle/code/csharp/Conversion.qll +++ b/csharp/ql/lib/semmle/code/csharp/Conversion.qll @@ -533,9 +533,7 @@ predicate convSpan(Type fromType, Type toType) { ) and toElementType = toType.(ReadOnlySpanType).getElementType() | - convIdentity(fromElementType, toElementType) - or - convVariance(fromElementType, toElementType) + convRefTypeNonNull(fromElementType, toElementType) ) or fromType instanceof SystemStringClass and