diff --git a/csharp/ql/src/semmle/code/cil/ConsistencyChecks.qll b/csharp/ql/src/semmle/code/cil/ConsistencyChecks.qll index 7c3b751a2de9..05bb424ac133 100644 --- a/csharp/ql/src/semmle/code/cil/ConsistencyChecks.qll +++ b/csharp/ql/src/semmle/code/cil/ConsistencyChecks.qll @@ -315,7 +315,7 @@ class InvalidReturn extends InstructionViolation { /** * A throw instruction that does not have a stack size of 0 after it. */ -class InvalidThrow extends InstructionViolation { +class InvalidThrow extends InstructionViolation, DisabledCheck { InvalidThrow() { instruction instanceof Throw and instruction.getStackSizeAfter() != 0 } override string getMessage() { diff --git a/csharp/ql/test/library-tests/cil/consistency/consistency.expected b/csharp/ql/test/library-tests/cil/consistency/consistency.expected index 5adb77d40a2b..d80b9543a10b 100644 --- a/csharp/ql/test/library-tests/cil/consistency/consistency.expected +++ b/csharp/ql/test/library-tests/cil/consistency/consistency.expected @@ -1,6 +1 @@ -| System.Guid System.Guid.ParseExact(System.String,System.String): 11: throw, 0: ldarg.0 [push: 1, pop: 0]; 1: brtrue.s 5: [push: 0, pop: 1]; 2: ldstr "input" [push: 1, pop: 0]; 3: newobj System.ArgumentNullException..ctor [push: 1, pop: 1]; 4: throw [push: 0, pop: 1]; 5: ldarg.0 [push: 1, pop: 0]; 6: call System.String.op_Implicit [push: 1, pop: 1]; 7: ldarg.1 [push: 1, pop: 0]; 8: brtrue.s 12: [push: 0, pop: 1]; 9: ldstr "format" [push: 1, pop: 0]; 10: newobj System.ArgumentNullException..ctor [push: 1, pop: 1]; 11: throw [push: 0, pop: 1] | Throw has invalid stack size: 1 | | System.Runtime.CompilerServices.AsyncTaskMethodBuilder.DebugFinalizableAsyncStateMachineBox.Finalize | Overridden method from System.Object is not in a base type | -| System.Threading.CancellationTokenRegistration System.Threading.CancellationToken.Register(System.Action): 8: throw, 0: ldarg.0 [push: 1, pop: 0]; 1: ldsfld s_actionToActionObjShunt [push: 1, pop: 0]; 2: ldarg.1 [push: 1, pop: 0]; 3: dup [push: 2, pop: 1]; 4: brtrue.s 9: [push: 0, pop: 1]; 5: pop [push: 0, pop: 1]; 6: ldstr "callback" [push: 1, pop: 0]; 7: newobj System.ArgumentNullException..ctor [push: 1, pop: 1]; 8: throw [push: 0, pop: 1] | Throw has invalid stack size: 2 | -| System.Threading.CancellationTokenRegistration System.Threading.CancellationToken.Register(System.Action,System.Boolean): 8: throw, 0: ldarg.0 [push: 1, pop: 0]; 1: ldsfld s_actionToActionObjShunt [push: 1, pop: 0]; 2: ldarg.1 [push: 1, pop: 0]; 3: dup [push: 2, pop: 1]; 4: brtrue.s 9: [push: 0, pop: 1]; 5: pop [push: 0, pop: 1]; 6: ldstr "callback" [push: 1, pop: 0]; 7: newobj System.ArgumentNullException..ctor [push: 1, pop: 1]; 8: throw [push: 0, pop: 1] | Throw has invalid stack size: 2 | -| System.Void System.Guid..ctor(System.Byte[]): 7: throw, 0: ldarg.0 [push: 1, pop: 0]; 1: ldarg.1 [push: 1, pop: 0]; 2: dup [push: 2, pop: 1]; 3: brtrue.s 8: [push: 0, pop: 1]; 4: pop [push: 0, pop: 1]; 5: ldstr "b" [push: 1, pop: 0]; 6: newobj System.ArgumentNullException..ctor [push: 1, pop: 1]; 7: throw [push: 0, pop: 1] | Throw has invalid stack size: 1 | -| System.Void System.TermInfo.Database..ctor(System.String,System.Byte[]): 33: throw, 0: ldarg.0 [push: 1, pop: 0]; 1: call System.Object..ctor [push: 0, pop: 1]; 2: ldarg.0 [push: 1, pop: 0]; 3: ldarg.1 [push: 1, pop: 0]; 4: stfld _term [push: 0, pop: 2]; 5: ldarg.0 [push: 1, pop: 0]; 6: ldarg.2 [push: 1, pop: 0]; 7: stfld _data [push: 0, pop: 2]; 8: ldarg.2 [push: 1, pop: 0]; 9: ldc.i4.0 [push: 1, pop: 0]; 10: call System.TermInfo.Database.ReadInt16 [push: 1, pop: 2]; 11: stloc.0 L0 [push: 0, pop: 1]; 12: ldarg.0 [push: 1, pop: 0]; 13: ldloc.0 [push: 1, pop: 0]; 14: ldc.i4 72224 [push: 1, pop: 0]; 15: beq.s 36: [push: 0, pop: 2]; 16: ldloc.0 [push: 1, pop: 0]; 17: ldc.i4 138784 [push: 1, pop: 0]; 18: beq.s 34: [push: 0, pop: 2]; 19: call System.SR.get_IO_TermInfoInvalidMagicNumber [push: 1, pop: 0]; 20: ldc.i4.1 [push: 1, pop: 0]; 21: newarr System.String [push: 1, pop: 1]; 22: dup [push: 2, pop: 1]; 23: ldc.i4.0 [push: 1, pop: 0]; 24: ldstr "O" [push: 1, pop: 0]; 25: ldloc.0 [push: 1, pop: 0]; 26: ldc.i4.8 [push: 1, pop: 0]; 27: call System.Convert.ToString [push: 1, pop: 2]; 28: call System.String.Concat [push: 1, pop: 2]; 29: stelem.ref [push: 0, pop: 3]; 30: call System.String.Concat [push: 1, pop: 1]; 31: call System.SR.Format [push: 1, pop: 2]; 32: newobj System.InvalidOperationException..ctor [push: 1, pop: 1]; 33: throw [push: 0, pop: 1] | Throw has invalid stack size: 1 | diff --git a/csharp/ql/test/library-tests/cil/dataflow/CallableReturns.expected b/csharp/ql/test/library-tests/cil/dataflow/CallableReturns.expected index 6274315a9053..7f25ad7f245a 100644 --- a/csharp/ql/test/library-tests/cil/dataflow/CallableReturns.expected +++ b/csharp/ql/test/library-tests/cil/dataflow/CallableReturns.expected @@ -9,16 +9,11 @@ alwaysNull | System.Object System.Collections.EmptyReadOnlyDictionaryInternal.get_Item(System.Object) | 0: ldarg.1, 1: brtrue.s 6:, 2: ldstr "key", 3: call System.SR.get_ArgumentNull_Key, 4: newobj System.ArgumentNullException..ctor, 5: throw, 6: ldnull, 7: ret | alwaysNonNull | System.ArgumentException System.ThrowHelper.GetAddingDuplicateWithKeyArgumentException(System.Object) | -| System.ArgumentException System.ThrowHelper.GetArgumentException(System.ExceptionResource) | -| System.ArgumentException System.ThrowHelper.GetArgumentException(System.ExceptionResource,System.ExceptionArgument) | | System.ArgumentException System.ThrowHelper.GetWrongKeyTypeArgumentException(System.Object,System.Type) | | System.ArgumentException System.ThrowHelper.GetWrongValueTypeArgumentException(System.Object,System.Type) | | System.ArgumentNullException System.ThrowHelper.GetArgumentNullException(System.ExceptionArgument) | -| System.ArgumentOutOfRangeException System.ThrowHelper.GetArgumentOutOfRangeException(System.ExceptionArgument,System.ExceptionResource) | -| System.ArgumentOutOfRangeException System.ThrowHelper.GetArgumentOutOfRangeException(System.ExceptionArgument,System.Int32,System.ExceptionResource) | | System.Collections.Generic.KeyNotFoundException System.ThrowHelper.GetKeyNotFoundException(System.Object) | | System.Exception System.ThrowHelper.GetArraySegmentCtorValidationFailedException(System.Array,System.Int32,System.Int32) | -| System.InvalidOperationException System.ThrowHelper.GetInvalidOperationException(System.ExceptionResource) | | System.InvalidOperationException System.ThrowHelper.GetInvalidOperationException_EnumCurrent(System.Int32) | | System.Object Dataflow.NonNullMethods.ReturnsNonNull2() | | System.Object Dataflow.NonNullMethods.ReturnsNonNull() | @@ -41,25 +36,18 @@ alwaysThrows | System.Object System.ValueTuple.get_Item(System.Int32) | System.IndexOutOfRangeException | 0: newobj System.IndexOutOfRangeException..ctor, 1: throw | | System.Void System.ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException`1(!0) | System.ArgumentException | 0: ldarg.0, 1: box, 2: call System.ThrowHelper.GetAddingDuplicateWithKeyArgumentException, 3: throw | | System.Void System.ThrowHelper.ThrowAggregateException(System.Collections.Generic.List) | System.AggregateException | 0: ldarg.0, 1: newobj System.AggregateException..ctor, 2: throw | -| System.Void System.ThrowHelper.ThrowArgumentException(System.ExceptionResource) | System.ArgumentException | 0: ldarg.0, 1: call System.ThrowHelper.GetArgumentException, 2: throw | -| System.Void System.ThrowHelper.ThrowArgumentException(System.ExceptionResource,System.ExceptionArgument) | System.ArgumentException | 0: ldarg.0, 1: ldarg.1, 2: call System.ThrowHelper.GetArgumentException, 3: throw | | System.Void System.ThrowHelper.ThrowArgumentException_Argument_InvalidArrayType() | System.ArgumentException | 0: ldc.i4.s 31, 1: call System.ThrowHelper.GetArgumentException, 2: throw | | System.Void System.ThrowHelper.ThrowArgumentException_DestinationTooShort() | System.ArgumentException | 0: call System.SR.get_Argument_DestinationTooShort, 1: newobj System.ArgumentException..ctor, 2: throw | | System.Void System.ThrowHelper.ThrowArgumentException_OverlapAlignmentMismatch() | System.ArgumentException | 0: call System.SR.get_Argument_OverlapAlignmentMismatch, 1: newobj System.ArgumentException..ctor, 2: throw | | System.Void System.ThrowHelper.ThrowArgumentNullException(System.ExceptionArgument) | System.ArgumentNullException | 0: ldarg.0, 1: call System.ThrowHelper.GetArgumentNullException, 2: throw | -| System.Void System.ThrowHelper.ThrowArgumentNullException(System.ExceptionArgument,System.ExceptionResource) | System.ArgumentNullException | 0: ldarg.0, 1: call System.ThrowHelper.GetArgumentName, 2: ldarg.1, 3: call System.ThrowHelper.GetResourceString, 4: newobj System.ArgumentNullException..ctor, 5: throw | | System.Void System.ThrowHelper.ThrowArgumentOutOfRangeException() | System.ArgumentOutOfRangeException | 0: newobj System.ArgumentOutOfRangeException..ctor, 1: throw | | System.Void System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument) | System.ArgumentOutOfRangeException | 0: ldarg.0, 1: call System.ThrowHelper.GetArgumentName, 2: newobj System.ArgumentOutOfRangeException..ctor, 3: throw | -| System.Void System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument,System.ExceptionResource) | System.ArgumentOutOfRangeException | 0: ldarg.0, 1: ldarg.1, 2: call System.ThrowHelper.GetArgumentOutOfRangeException, 3: throw | -| System.Void System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument,System.Int32,System.ExceptionResource) | System.ArgumentOutOfRangeException | 0: ldarg.0, 1: ldarg.1, 2: ldarg.2, 3: call System.ThrowHelper.GetArgumentOutOfRangeException, 4: throw | | System.Void System.ThrowHelper.ThrowArgumentOutOfRange_IndexException() | System.ArgumentOutOfRangeException | 0: ldc.i4.s 31, 1: ldc.i4.s 31, 2: call System.ThrowHelper.GetArgumentOutOfRangeException, 3: throw | | System.Void System.ThrowHelper.ThrowArraySegmentCtorValidationFailedExceptions(System.Array,System.Int32,System.Int32) | System.Exception | 0: ldarg.0, 1: ldarg.1, 2: ldarg.2, 3: call System.ThrowHelper.GetArraySegmentCtorValidationFailedException, 4: throw | | System.Void System.ThrowHelper.ThrowArrayTypeMismatchException() | System.ArrayTypeMismatchException | 0: newobj System.ArrayTypeMismatchException..ctor, 1: throw | | System.Void System.ThrowHelper.ThrowCountArgumentOutOfRange_ArgumentOutOfRange_Count() | System.ArgumentOutOfRangeException | 0: ldc.i4.s 31, 1: ldc.i4.s 31, 2: call System.ThrowHelper.GetArgumentOutOfRangeException, 3: throw | | System.Void System.ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException() | System.ArgumentOutOfRangeException | 0: ldc.i4.s 31, 1: ldc.i4.4, 2: call System.ThrowHelper.GetArgumentOutOfRangeException, 3: throw | | System.Void System.ThrowHelper.ThrowIndexOutOfRangeException() | System.IndexOutOfRangeException | 0: newobj System.IndexOutOfRangeException..ctor, 1: throw | -| System.Void System.ThrowHelper.ThrowInvalidOperationException(System.ExceptionResource) | System.InvalidOperationException | 0: ldarg.0, 1: call System.ThrowHelper.GetInvalidOperationException, 2: throw | -| System.Void System.ThrowHelper.ThrowInvalidOperationException(System.ExceptionResource,System.Exception) | System.InvalidOperationException | 0: ldarg.0, 1: call System.ThrowHelper.GetResourceString, 2: ldarg.1, 3: newobj System.InvalidOperationException..ctor, 4: throw | | System.Void System.ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported() | System.InvalidOperationException | 0: ldc.i4.s 31, 1: call System.ThrowHelper.GetInvalidOperationException, 2: throw | | System.Void System.ThrowHelper.ThrowInvalidOperationException_EnumCurrent(System.Int32) | System.InvalidOperationException | 0: ldarg.0, 1: call System.ThrowHelper.GetInvalidOperationException_EnumCurrent, 2: throw | | System.Void System.ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumEnded() | System.InvalidOperationException | 0: ldc.i4.s 31, 1: call System.ThrowHelper.GetInvalidOperationException, 2: throw | @@ -71,11 +59,7 @@ alwaysThrows | System.Void System.ThrowHelper.ThrowKeyNotFoundException`1(!0) | System.Collections.Generic.KeyNotFoundException | 0: ldarg.0, 1: box, 2: call System.ThrowHelper.GetKeyNotFoundException, 3: throw | | System.Void System.ThrowHelper.ThrowLengthArgumentOutOfRange_ArgumentOutOfRange_NeedNonNegNum() | System.ArgumentOutOfRangeException | 0: ldc.i4.s 31, 1: ldc.i4.4, 2: call System.ThrowHelper.GetArgumentOutOfRangeException, 3: throw | | System.Void System.ThrowHelper.ThrowNotSupportedException() | System.NotSupportedException | 0: newobj System.NotSupportedException..ctor, 1: throw | -| System.Void System.ThrowHelper.ThrowNotSupportedException(System.ExceptionResource) | System.NotSupportedException | 0: ldarg.0, 1: call System.ThrowHelper.GetResourceString, 2: newobj System.NotSupportedException..ctor, 3: throw | -| System.Void System.ThrowHelper.ThrowObjectDisposedException(System.ExceptionResource) | System.ObjectDisposedException | 0: ldnull, 1: ldarg.0, 2: call System.ThrowHelper.GetResourceString, 3: newobj System.ObjectDisposedException..ctor, 4: throw | | System.Void System.ThrowHelper.ThrowOutOfMemoryException() | System.OutOfMemoryException | 0: newobj System.OutOfMemoryException..ctor, 1: throw | -| System.Void System.ThrowHelper.ThrowRankException(System.ExceptionResource) | System.RankException | 0: ldarg.0, 1: call System.ThrowHelper.GetResourceString, 2: newobj System.RankException..ctor, 3: throw | -| System.Void System.ThrowHelper.ThrowSerializationException(System.ExceptionResource) | System.Runtime.Serialization.SerializationException | 0: ldarg.0, 1: call System.ThrowHelper.GetResourceString, 2: newobj System.Runtime.Serialization.SerializationException..ctor, 3: throw | | System.Void System.ThrowHelper.ThrowStartIndexArgumentOutOfRange_ArgumentOutOfRange_Index() | System.ArgumentOutOfRangeException | 0: ldc.i4.s 31, 1: ldc.i4.s 31, 2: call System.ThrowHelper.GetArgumentOutOfRangeException, 3: throw | | System.Void System.ThrowHelper.ThrowWrongKeyTypeArgumentException`1(!0,System.Type) | System.ArgumentException | 0: ldarg.0, 1: box, 2: ldarg.1, 3: call System.ThrowHelper.GetWrongKeyTypeArgumentException, 4: throw | | System.Void System.ThrowHelper.ThrowWrongValueTypeArgumentException`1(!0,System.Type) | System.ArgumentException | 0: ldarg.0, 1: box, 2: ldarg.1, 3: call System.ThrowHelper.GetWrongValueTypeArgumentException, 4: throw | diff --git a/csharp/ql/test/library-tests/cil/dataflow/CallableReturns.ql b/csharp/ql/test/library-tests/cil/dataflow/CallableReturns.ql index 6aaca97ddde2..8e32dd08514f 100644 --- a/csharp/ql/test/library-tests/cil/dataflow/CallableReturns.ql +++ b/csharp/ql/test/library-tests/cil/dataflow/CallableReturns.ql @@ -6,7 +6,8 @@ predicate relevantMethod(CIL::Method m) { or m.getName() = "get_Item" or - m.getDeclaringType().getName() = "ThrowHelper" + m.getDeclaringType().getName() = "ThrowHelper" and + not m.getParameter(_).getType().getName() = "ExceptionResource" or m.getLocation().(CIL::Assembly).getName().matches("DataFlow%") } diff --git a/csharp/ql/test/library-tests/commons/Disposal/Class1.cs_ b/csharp/ql/test/library-tests/commons/Disposal/Class1.cs_ new file mode 100644 index 000000000000..ed948c053d05 --- /dev/null +++ b/csharp/ql/test/library-tests/commons/Disposal/Class1.cs_ @@ -0,0 +1,42 @@ +using System; + +namespace DisposalTests +{ + public class MyType : IDisposable + { + public void Dispose() + { + } + } + + public class Class1 : IDisposable + { + public void DisposesParameter(IDisposable p1, IDisposable p2) + { + p1.Dispose(); + } + + public void CapturesDisposable(MyType p1, MyType p2) + { + field1 = p1; + field2 = p2; + } + + public void DisposesSelf() + { + Dispose(); + } + + MyType field1, field2; + + public void Dispose() + { + field1.Dispose(); + } + + public static void Dispose(IDisposable d) + { + d.Dispose(); + } + } +} diff --git a/csharp/ql/test/library-tests/commons/Disposal/Disposal.cs b/csharp/ql/test/library-tests/commons/Disposal/Disposal.cs index 08fcbfd1e204..8082bc50f098 100644 --- a/csharp/ql/test/library-tests/commons/Disposal/Disposal.cs +++ b/csharp/ql/test/library-tests/commons/Disposal/Disposal.cs @@ -21,6 +21,6 @@ public Disposal(IDisposable p1, object p2, System.IO.TextWriter fs) field1 = p1; if(p2 is IDisposable d) d.Dispose(); - Console.SetOut(fs); + DisposalTests.Class1.Dispose(fs); } } diff --git a/csharp/ql/test/library-tests/commons/Disposal/DisposalTests.dll b/csharp/ql/test/library-tests/commons/Disposal/DisposalTests.dll new file mode 100644 index 000000000000..f731c5af9e11 Binary files /dev/null and b/csharp/ql/test/library-tests/commons/Disposal/DisposalTests.dll differ diff --git a/csharp/ql/test/library-tests/commons/Disposal/DisposedFields.expected b/csharp/ql/test/library-tests/commons/Disposal/DisposedFields.expected index 4228710ca860..d3d33271d450 100644 --- a/csharp/ql/test/library-tests/commons/Disposal/DisposedFields.expected +++ b/csharp/ql/test/library-tests/commons/Disposal/DisposedFields.expected @@ -1,49 +1 @@ -| System.IO.BufferedStream._stream | -| System.IO.Stream.SyncStream._stream | -| System.IO.SyncTextReader._in | -| System.IO.SyncTextWriter._out | -| System.IO.UnmanagedMemoryStreamWrapper._unmanagedStream | -| System.Net.Http.DecompressionHandler.DecompressedContent._originalContent | -| System.Net.Http.DecompressionHandler._innerHandler | -| System.Net.Http.DelegatingHandler._innerHandler | -| System.Net.Http.DelegatingStream._innerStream | -| System.Net.Http.HttpAuthenticatedConnectionHandler._poolManager | -| System.Net.Http.HttpClient._pendingRequestsCts | -| System.Net.Http.HttpConnection.HttpConnectionResponseContent._stream | -| System.Net.Http.HttpConnection._stream | -| System.Net.Http.HttpConnectionHandler._poolManager | -| System.Net.Http.HttpConnectionPool.CachedConnection._connection | -| System.Net.Http.HttpConnectionPool.ConnectionWaiter._cancellationTokenRegistration | -| System.Net.Http.HttpConnectionPoolManager._cleaningTimer | -| System.Net.Http.HttpContent._bufferedContent | -| System.Net.Http.HttpContentStream._connection | -| System.Net.Http.HttpMessageInvoker._handler | -| System.Net.Http.HttpRequestMessage._content | -| System.Net.Http.HttpResponseMessage._content | -| System.Net.Http.NoWriteNoSeekStreamContent._content | -| System.Net.Http.RedirectHandler._initialInnerHandler | -| System.Net.Http.RedirectHandler._redirectInnerHandler | -| System.Net.Http.SocketsHttpHandler._handler | -| System.Net.Http.StreamContent._content | -| System.Net.NTAuthentication._credentialsHandle | -| System.Net.NTAuthentication._securityContext | -| System.Net.Security.SafeDeleteNegoContext._context | -| System.Net.Security.SafeDeleteNegoContext._targetName | -| System.Security.SecureString._buffer | -| System.Threading.CancellationTokenSource.Linked1CancellationTokenSource._reg1 | -| System.Threading.CancellationTokenSource.Linked2CancellationTokenSource._reg1 | -| System.Threading.CancellationTokenSource.Linked2CancellationTokenSource._reg2 | -| System.Threading.CancellationTokenSource._timer | -| System.Threading.ReaderWriterLockSlim._readEvent | -| System.Threading.ReaderWriterLockSlim._upgradeEvent | -| System.Threading.ReaderWriterLockSlim._waitUpgradeEvent | -| System.Threading.ReaderWriterLockSlim._writeEvent | -| System.Xml.Serialization.XmlCountingReader._innerReader | -| System.Xml.XmlAsyncCheckReader._coreReader | -| System.Xml.XmlAsyncCheckWriter._coreWriter | -| System.Xml.XmlAutoDetectWriter._strm | -| System.Xml.XmlAutoDetectWriter._textWriter | -| System.Xml.XmlAutoDetectWriter._wrapped | -| System.Xml.XmlSqlBinaryReader._inStrm | -| System.Xml.XmlTextWriter._textWriter | -| System.Xml.Xsl.Runtime.XmlRawWriterWrapper._wrapped | +| DisposalTests.Class1.field1 | diff --git a/csharp/ql/test/library-tests/commons/Disposal/DisposedFields.ql b/csharp/ql/test/library-tests/commons/Disposal/DisposedFields.ql index c9cf46facf40..6df087748d4d 100644 --- a/csharp/ql/test/library-tests/commons/Disposal/DisposedFields.ql +++ b/csharp/ql/test/library-tests/commons/Disposal/DisposedFields.ql @@ -1,10 +1,8 @@ import cil import semmle.code.csharp.commons.Disposal -import Whitelist from CIL::Field field where mayBeDisposed(field) and - field.getName().charAt(0) = "_" and // Filter the results a little - not whitelistedType(field.getDeclaringType()) + field.getDeclaringType().getQualifiedName() = "DisposalTests.Class1" select field.getQualifiedName() diff --git a/csharp/ql/test/library-tests/commons/Disposal/DisposedParameter.expected b/csharp/ql/test/library-tests/commons/Disposal/DisposedParameter.expected index 917ea971094a..33bd2568ecab 100644 --- a/csharp/ql/test/library-tests/commons/Disposal/DisposedParameter.expected +++ b/csharp/ql/test/library-tests/commons/Disposal/DisposedParameter.expected @@ -1,348 +1,6 @@ -| BufferedStream(Stream) | 0 | -| BufferedStream(Stream, int) | 0 | -| CachedConnection(HttpConnection) | 0 | -| ChunkedEncodingReadStream(HttpConnection) | 0 | -| ChunkedEncodingWriteStream(HttpConnection) | 0 | -| ConnectionCloseReadStream(HttpConnection) | 0 | -| ContentLengthReadStream(HttpConnection, ulong) | 0 | -| ContentLengthWriteStream(HttpConnection) | 0 | -| CopyAsync(Stream, Stream, int, bool, CancellationToken) | 0 | -| CopyToWriter(XmlWriter) | 0 | -| Create(Stream) | 0 | -| Create(Stream, XmlReaderSettings) | 0 | -| Create(Stream, XmlReaderSettings, XmlParserContext) | 0 | -| Create(Stream, XmlReaderSettings, string) | 0 | -| Create(Stream, XmlWriterSettings) | 0 | -| Create(TextReader) | 0 | -| Create(TextReader, XmlReaderSettings) | 0 | -| Create(TextReader, XmlReaderSettings, XmlParserContext) | 0 | -| Create(TextReader, XmlReaderSettings, string) | 0 | -| Create(TextWriter) | 0 | -| Create(TextWriter, XmlWriterSettings) | 0 | -| Create(XmlWriter) | 0 | -| Create(XmlWriter, XmlWriterSettings) | 0 | -| CreateAsyncCheckWrapper(XmlReader) | 0 | -| CreateReader(Stream, string) | 0 | -| DecompressedContent(HttpContent) | 0 | -| DeflateDecompressedContent(HttpContent) | 0 | -| DelegatingHandler(HttpMessageHandler) | 0 | -| DelegatingStream(Stream) | 0 | -| Deserialize(Stream) | 0 | -| Deserialize(TextReader) | 0 | -| Deserialize(XmlReader) | 0 | -| Deserialize(XmlReader, XmlDeserializationEvents) | 0 | -| Deserialize(XmlReader, string) | 0 | -| Deserialize(XmlReader, string, XmlDeserializationEvents) | 0 | -| DiagnosticsHandler(HttpMessageHandler) | 0 | -| Disposal(IDisposable, object, TextWriter) | 0 | -| Disposal(IDisposable, object, TextWriter) | 1 | -| Disposal(IDisposable, object, TextWriter) | 2 | -| DrainResponseAsync(HttpResponseMessage) | 0 | -| EventsToWriter(XmlWriter) | 0 | -| Execute(object, XmlResolver, XsltArgumentList, XmlWriter) | 3 | -| GZipDecompressedContent(HttpContent) | 0 | -| GetSynchronizedTextReader(TextReader) | 0 | -| HtmlEncodedRawTextWriter(Stream, XmlWriterSettings) | 0 | -| HtmlEncodedRawTextWriter(TextWriter, XmlWriterSettings) | 0 | -| HtmlEncodedRawTextWriterIndent(Stream, XmlWriterSettings) | 0 | -| HtmlEncodedRawTextWriterIndent(TextWriter, XmlWriterSettings) | 0 | -| HtmlUtf8RawTextWriter(Stream, XmlWriterSettings) | 0 | -| HtmlUtf8RawTextWriterIndent(Stream, XmlWriterSettings) | 0 | -| HttpAuthenticatedConnectionHandler(HttpConnectionPoolManager) | 0 | -| HttpClient(HttpMessageHandler) | 0 | -| HttpClient(HttpMessageHandler, bool) | 0 | -| HttpConnectionHandler(HttpConnectionPoolManager) | 0 | -| HttpContentDuplexStream(HttpConnection) | 0 | -| HttpContentReadStream(HttpConnection) | 0 | -| HttpContentStream(HttpConnection) | 0 | -| HttpContentWriteStream(HttpConnection) | 0 | -| HttpMessageInvoker(HttpMessageHandler) | 0 | -| HttpMessageInvoker(HttpMessageHandler, bool) | 0 | -| Load(Stream) | 0 | -| Load(TextReader) | 0 | -| MessageProcessingHandler(HttpMessageHandler) | 0 | -| PatchAsync(string, HttpContent) | 1 | -| PatchAsync(string, HttpContent, CancellationToken) | 1 | -| PostAsync(string, HttpContent) | 1 | -| PostAsync(string, HttpContent, CancellationToken) | 1 | -| PutAsync(string, HttpContent) | 1 | -| PutAsync(string, HttpContent, CancellationToken) | 1 | -| RawConnectionStream(HttpConnection) | 0 | -| Read(Stream, ValidationEventHandler) | 0 | -| Read(TextReader, ValidationEventHandler) | 0 | -| ReadOnlyStream(Stream) | 0 | -| RedirectHandler(int, HttpMessageHandler, HttpMessageHandler) | 1 | -| RedirectHandler(int, HttpMessageHandler, HttpMessageHandler) | 2 | -| ReflectionXmlSerializationReader(XmlMapping, XmlReader, XmlDeserializationEvents, string) | 1 | -| ReturnConnection(HttpConnection) | 0 | -| Save(TextWriter) | 0 | -| SendWithNtProxyAuthAsync(HttpConnection, HttpRequestMessage, CancellationToken) | 0 | -| Serialize(TextWriter, object) | 0 | -| Serialize(TextWriter, object, XmlSerializerNamespaces) | 0 | -| SetError(TextWriter) | 0 | -| SetGssContext(SafeGssContextHandle) | 0 | -| SetIn(TextReader) | 0 | -| SetOut(TextWriter) | 0 | -| SetStream(HttpContentStream) | 0 | -| StreamContent(Stream) | 0 | -| StreamContent(Stream, int) | 0 | -| Synchronized(Stream) | 0 | -| System.IO.Stream System.IO.Stream.Synchronized(System.IO.Stream) | 0 | -| System.IO.SyncTextReader System.IO.SyncTextReader.GetSynchronizedTextReader(System.IO.TextReader) | 0 | -| System.IO.SyncTextWriter System.IO.SyncTextWriter.GetSynchronizedTextWriter(System.IO.TextWriter) | 0 | -| System.Int32 System.Net.Http.HttpConnection.ChunkedEncodingReadStream.ReadChunksFromConnectionBuffer(System.Span,System.Threading.CancellationTokenRegistration) | 1 | -| System.Object System.Xml.Serialization.TempAssembly.InvokeReader(System.Xml.Serialization.XmlMapping,System.Xml.XmlReader,System.Xml.Serialization.XmlDeserializationEvents,System.String) | 1 | -| System.Object System.Xml.Serialization.XmlSerializer.Deserialize(System.IO.Stream) | 0 | -| System.Object System.Xml.Serialization.XmlSerializer.Deserialize(System.IO.TextReader) | 0 | -| System.Object System.Xml.Serialization.XmlSerializer.Deserialize(System.Xml.XmlReader) | 0 | -| System.Object System.Xml.Serialization.XmlSerializer.Deserialize(System.Xml.XmlReader,System.String) | 0 | -| System.Object System.Xml.Serialization.XmlSerializer.Deserialize(System.Xml.XmlReader,System.String,System.Xml.Serialization.XmlDeserializationEvents) | 0 | -| System.Object System.Xml.Serialization.XmlSerializer.Deserialize(System.Xml.XmlReader,System.Xml.Serialization.XmlDeserializationEvents) | 0 | -| System.Object System.Xml.Serialization.XmlSerializer.DeserializePrimitive(System.Xml.XmlReader,System.Xml.Serialization.XmlDeserializationEvents) | 0 | -| System.Object System.Xml.Serialization.XmlSerializer.DeserializeUsingReflection(System.Xml.XmlReader,System.String,System.Xml.Serialization.XmlDeserializationEvents) | 0 | -| System.ReadOnlyMemory System.Net.Http.HttpConnection.ChunkedEncodingReadStream.ReadChunkFromConnectionBuffer(System.Int32,System.Threading.CancellationTokenRegistration) | 1 | -| System.Threading.Tasks.Task System.Net.Http.HttpConnection.DrainResponseAsync(System.Net.Http.HttpResponseMessage) | 0 | -| System.Threading.Tasks.Task System.Net.Http.HttpConnection.SendRequestContentWithExpect100ContinueAsync(System.Net.Http.HttpRequestMessage,System.Threading.Tasks.Task,System.Net.Http.HttpConnection.HttpContentWriteStream,System.Threading.Timer,System.Threading.CancellationToken) | 3 | -| System.Threading.Tasks.Task System.Net.Http.HttpContent.LoadIntoBufferAsyncCore(System.Threading.Tasks.Task,System.IO.MemoryStream) | 1 | -| System.Threading.Tasks.Task System.Net.Http.StreamToStreamCopy.CopyAsync(System.IO.Stream,System.IO.Stream,System.Int32,System.Boolean,System.Threading.CancellationToken) | 0 | -| System.Threading.Tasks.Task System.Net.Http.StreamToStreamCopy.DisposeSourceWhenCompleteAsync(System.Threading.Tasks.Task,System.IO.Stream) | 1 | -| System.Threading.Tasks.Task System.Xml.XmlTextReaderImpl.InitStreamInputAsync(System.Uri,System.IO.Stream,System.Text.Encoding) | 1 | -| System.Threading.Tasks.Task System.Xml.XmlTextReaderImpl.InitStreamInputAsync(System.Uri,System.String,System.IO.Stream,System.Byte[],System.Int32,System.Text.Encoding) | 2 | -| System.Threading.Tasks.Task System.Xml.XmlTextReaderImpl.InitTextReaderInputAsync(System.String,System.IO.TextReader) | 1 | -| System.Threading.Tasks.Task System.Xml.XmlTextReaderImpl.InitTextReaderInputAsync(System.String,System.Uri,System.IO.TextReader) | 2 | -| System.Threading.Tasks.Task System.Net.Http.AuthenticationHelper.InnerSendAsync(System.Net.Http.HttpRequestMessage,System.Boolean,System.Net.Http.HttpConnectionPool,System.Net.Http.HttpConnection,System.Threading.CancellationToken) | 3 | -| System.Threading.Tasks.Task System.Net.Http.AuthenticationHelper.SendWithNtAuthAsync(System.Net.Http.HttpRequestMessage,System.Uri,System.Net.ICredentials,System.Boolean,System.Net.Http.HttpConnection,System.Net.Http.HttpConnectionPool,System.Threading.CancellationToken) | 4 | -| System.Threading.Tasks.Task System.Net.Http.AuthenticationHelper.SendWithNtConnectionAuthAsync(System.Net.Http.HttpRequestMessage,System.Net.ICredentials,System.Net.Http.HttpConnection,System.Net.Http.HttpConnectionPool,System.Threading.CancellationToken) | 2 | -| System.Threading.Tasks.Task System.Net.Http.AuthenticationHelper.SendWithNtProxyAuthAsync(System.Net.Http.HttpRequestMessage,System.Uri,System.Net.ICredentials,System.Net.Http.HttpConnection,System.Net.Http.HttpConnectionPool,System.Threading.CancellationToken) | 3 | -| System.Threading.Tasks.Task System.Net.Http.HttpClient.FinishSendAsyncBuffered(System.Threading.Tasks.Task,System.Net.Http.HttpRequestMessage,System.Threading.CancellationTokenSource,System.Boolean) | 2 | -| System.Threading.Tasks.Task System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(System.Threading.Tasks.Task,System.Net.Http.HttpRequestMessage,System.Threading.CancellationTokenSource,System.Boolean) | 2 | -| System.Threading.Tasks.Task System.Net.Http.HttpClient.PatchAsync(System.String,System.Net.Http.HttpContent) | 1 | -| System.Threading.Tasks.Task System.Net.Http.HttpClient.PatchAsync(System.String,System.Net.Http.HttpContent,System.Threading.CancellationToken) | 1 | -| System.Threading.Tasks.Task System.Net.Http.HttpClient.PatchAsync(System.Uri,System.Net.Http.HttpContent) | 1 | -| System.Threading.Tasks.Task System.Net.Http.HttpClient.PatchAsync(System.Uri,System.Net.Http.HttpContent,System.Threading.CancellationToken) | 1 | -| System.Threading.Tasks.Task System.Net.Http.HttpClient.PostAsync(System.String,System.Net.Http.HttpContent) | 1 | -| System.Threading.Tasks.Task System.Net.Http.HttpClient.PostAsync(System.String,System.Net.Http.HttpContent,System.Threading.CancellationToken) | 1 | -| System.Threading.Tasks.Task System.Net.Http.HttpClient.PostAsync(System.Uri,System.Net.Http.HttpContent) | 1 | -| System.Threading.Tasks.Task System.Net.Http.HttpClient.PostAsync(System.Uri,System.Net.Http.HttpContent,System.Threading.CancellationToken) | 1 | -| System.Threading.Tasks.Task System.Net.Http.HttpClient.PutAsync(System.String,System.Net.Http.HttpContent) | 1 | -| System.Threading.Tasks.Task System.Net.Http.HttpClient.PutAsync(System.String,System.Net.Http.HttpContent,System.Threading.CancellationToken) | 1 | -| System.Threading.Tasks.Task System.Net.Http.HttpClient.PutAsync(System.Uri,System.Net.Http.HttpContent) | 1 | -| System.Threading.Tasks.Task System.Net.Http.HttpClient.PutAsync(System.Uri,System.Net.Http.HttpContent,System.Threading.CancellationToken) | 1 | -| System.Threading.Tasks.Task System.Net.Http.HttpConnectionPool.SendWithNtConnectionAuthAsync(System.Net.Http.HttpConnection,System.Net.Http.HttpRequestMessage,System.Boolean,System.Threading.CancellationToken) | 0 | -| System.Threading.Tasks.Task System.Net.Http.HttpConnectionPool.SendWithNtProxyAuthAsync(System.Net.Http.HttpConnection,System.Net.Http.HttpRequestMessage,System.Threading.CancellationToken) | 0 | -| System.Void System.Console.SetError(System.IO.TextWriter) | 0 | -| System.Void System.Console.SetIn(System.IO.TextReader) | 0 | -| System.Void System.Console.SetOut(System.IO.TextWriter) | 0 | -| System.Void System.IO.BufferedStream..ctor(System.IO.Stream) | 0 | -| System.Void System.IO.BufferedStream..ctor(System.IO.Stream,System.Int32) | 0 | -| System.Void System.IO.Stream.SyncStream..ctor(System.IO.Stream) | 0 | -| System.Void System.IO.SyncTextReader..ctor(System.IO.TextReader) | 0 | -| System.Void System.IO.SyncTextWriter..ctor(System.IO.TextWriter) | 0 | -| System.Void System.IO.UnmanagedMemoryStreamWrapper..ctor(System.IO.UnmanagedMemoryStream) | 0 | -| System.Void System.Net.Http.DecompressionHandler..ctor(System.Net.DecompressionMethods,System.Net.Http.HttpMessageHandler) | 1 | -| System.Void System.Net.Http.DecompressionHandler.DecompressedContent..ctor(System.Net.Http.HttpContent) | 0 | -| System.Void System.Net.Http.DecompressionHandler.DeflateDecompressedContent..ctor(System.Net.Http.HttpContent) | 0 | -| System.Void System.Net.Http.DecompressionHandler.GZipDecompressedContent..ctor(System.Net.Http.HttpContent) | 0 | -| System.Void System.Net.Http.DelegatingHandler..ctor(System.Net.Http.HttpMessageHandler) | 0 | -| System.Void System.Net.Http.DelegatingHandler.set_InnerHandler(System.Net.Http.HttpMessageHandler) | 0 | -| System.Void System.Net.Http.DelegatingStream..ctor(System.IO.Stream) | 0 | -| System.Void System.Net.Http.DiagnosticsHandler..ctor(System.Net.Http.HttpMessageHandler) | 0 | -| System.Void System.Net.Http.HttpAuthenticatedConnectionHandler..ctor(System.Net.Http.HttpConnectionPoolManager) | 0 | -| System.Void System.Net.Http.HttpClient..ctor(System.Net.Http.HttpMessageHandler) | 0 | -| System.Void System.Net.Http.HttpClient..ctor(System.Net.Http.HttpMessageHandler,System.Boolean) | 0 | -| System.Void System.Net.Http.HttpClient.HandleFinishSendAsyncCleanup(System.Threading.CancellationTokenSource,System.Boolean) | 0 | -| System.Void System.Net.Http.HttpConnection..ctor(System.Net.Http.HttpConnectionPool,System.Net.Sockets.Socket,System.IO.Stream,System.Net.TransportContext) | 2 | -| System.Void System.Net.Http.HttpConnection.ChunkedEncodingReadStream..ctor(System.Net.Http.HttpConnection) | 0 | -| System.Void System.Net.Http.HttpConnection.ChunkedEncodingWriteStream..ctor(System.Net.Http.HttpConnection) | 0 | -| System.Void System.Net.Http.HttpConnection.ConnectionCloseReadStream..ctor(System.Net.Http.HttpConnection) | 0 | -| System.Void System.Net.Http.HttpConnection.ContentLengthReadStream..ctor(System.Net.Http.HttpConnection,System.UInt64) | 0 | -| System.Void System.Net.Http.HttpConnection.ContentLengthWriteStream..ctor(System.Net.Http.HttpConnection) | 0 | -| System.Void System.Net.Http.HttpConnection.HttpConnectionResponseContent.SetStream(System.Net.Http.HttpContentStream) | 0 | -| System.Void System.Net.Http.HttpConnection.HttpContentReadStream..ctor(System.Net.Http.HttpConnection) | 0 | -| System.Void System.Net.Http.HttpConnection.HttpContentWriteStream..ctor(System.Net.Http.HttpConnection) | 0 | -| System.Void System.Net.Http.HttpConnection.RawConnectionStream..ctor(System.Net.Http.HttpConnection) | 0 | -| System.Void System.Net.Http.HttpConnectionHandler..ctor(System.Net.Http.HttpConnectionPoolManager) | 0 | -| System.Void System.Net.Http.HttpConnectionPool.<>c.b__55_0(System.Net.Http.HttpConnection) | 0 | -| System.Void System.Net.Http.HttpConnectionPool.CachedConnection..ctor(System.Net.Http.HttpConnection) | 0 | -| System.Void System.Net.Http.HttpConnectionPool.ReturnConnection(System.Net.Http.HttpConnection) | 0 | -| System.Void System.Net.Http.HttpConnectionWithFinalizer..ctor(System.Net.Http.HttpConnectionPool,System.Net.Sockets.Socket,System.IO.Stream,System.Net.TransportContext) | 2 | -| System.Void System.Net.Http.HttpContentDuplexStream..ctor(System.Net.Http.HttpConnection) | 0 | -| System.Void System.Net.Http.HttpContentStream..ctor(System.Net.Http.HttpConnection) | 0 | -| System.Void System.Net.Http.HttpMessageInvoker..ctor(System.Net.Http.HttpMessageHandler) | 0 | -| System.Void System.Net.Http.HttpMessageInvoker..ctor(System.Net.Http.HttpMessageHandler,System.Boolean) | 0 | -| System.Void System.Net.Http.HttpRequestMessage.set_Content(System.Net.Http.HttpContent) | 0 | -| System.Void System.Net.Http.HttpResponseMessage.set_Content(System.Net.Http.HttpContent) | 0 | -| System.Void System.Net.Http.MessageProcessingHandler..ctor(System.Net.Http.HttpMessageHandler) | 0 | -| System.Void System.Net.Http.NoWriteNoSeekStreamContent..ctor(System.IO.Stream) | 0 | -| System.Void System.Net.Http.RedirectHandler..ctor(System.Int32,System.Net.Http.HttpMessageHandler,System.Net.Http.HttpMessageHandler) | 1 | -| System.Void System.Net.Http.RedirectHandler..ctor(System.Int32,System.Net.Http.HttpMessageHandler,System.Net.Http.HttpMessageHandler) | 2 | -| System.Void System.Net.Http.StreamContent..ctor(System.IO.Stream) | 0 | -| System.Void System.Net.Http.StreamContent..ctor(System.IO.Stream,System.Int32) | 0 | -| System.Void System.Net.Http.StreamContent.InitializeContent(System.IO.Stream,System.Int32) | 0 | -| System.Void System.Net.Http.StreamContent.ReadOnlyStream..ctor(System.IO.Stream) | 0 | -| System.Void System.Net.Http.StreamToStreamCopy.DisposeSource(System.IO.Stream) | 0 | -| System.Void System.Net.Security.SafeDeleteNegoContext.SetGssContext(Microsoft.Win32.SafeHandles.SafeGssContextHandle) | 0 | -| System.Void System.TypeNameParser..ctor(System.SafeTypeNameParserHandle) | 0 | -| System.Void System.Xml.HtmlEncodedRawTextWriter..ctor(System.IO.Stream,System.Xml.XmlWriterSettings) | 0 | -| System.Void System.Xml.HtmlEncodedRawTextWriter..ctor(System.IO.TextWriter,System.Xml.XmlWriterSettings) | 0 | -| System.Void System.Xml.HtmlEncodedRawTextWriterIndent..ctor(System.IO.Stream,System.Xml.XmlWriterSettings) | 0 | -| System.Void System.Xml.HtmlEncodedRawTextWriterIndent..ctor(System.IO.TextWriter,System.Xml.XmlWriterSettings) | 0 | -| System.Void System.Xml.HtmlUtf8RawTextWriter..ctor(System.IO.Stream,System.Xml.XmlWriterSettings) | 0 | -| System.Void System.Xml.HtmlUtf8RawTextWriterIndent..ctor(System.IO.Stream,System.Xml.XmlWriterSettings) | 0 | -| System.Void System.Xml.Schema.XmlSchema.Write(System.IO.TextWriter) | 0 | -| System.Void System.Xml.Schema.XmlSchema.Write(System.IO.TextWriter,System.Xml.XmlNamespaceManager) | 0 | -| System.Void System.Xml.Serialization.ReflectionXmlSerializationReader..ctor(System.Xml.Serialization.XmlMapping,System.Xml.XmlReader,System.Xml.Serialization.XmlDeserializationEvents,System.String) | 1 | -| System.Void System.Xml.Serialization.XmlCountingReader..ctor(System.Xml.XmlReader) | 0 | -| System.Void System.Xml.Serialization.XmlSerializationReader.Init(System.Xml.XmlReader,System.Xml.Serialization.XmlDeserializationEvents,System.String,System.Xml.Serialization.TempAssembly) | 0 | -| System.Void System.Xml.Serialization.XmlSerializer.Serialize(System.IO.TextWriter,System.Object) | 0 | -| System.Void System.Xml.Serialization.XmlSerializer.Serialize(System.IO.TextWriter,System.Object,System.Xml.Serialization.XmlSerializerNamespaces) | 0 | -| System.Void System.Xml.TextEncodedRawTextWriter..ctor(System.IO.Stream,System.Xml.XmlWriterSettings) | 0 | -| System.Void System.Xml.TextEncodedRawTextWriter..ctor(System.IO.TextWriter,System.Xml.XmlWriterSettings) | 0 | -| System.Void System.Xml.TextUtf8RawTextWriter..ctor(System.IO.Stream,System.Xml.XmlWriterSettings) | 0 | -| System.Void System.Xml.XPath.XPathDocument..ctor(System.IO.Stream) | 0 | -| System.Void System.Xml.XPath.XPathDocument..ctor(System.IO.TextReader) | 0 | -| System.Void System.Xml.XmlAsyncCheckReader..ctor(System.Xml.XmlReader) | 0 | -| System.Void System.Xml.XmlAsyncCheckReaderWithLineInfo..ctor(System.Xml.XmlReader) | 0 | -| System.Void System.Xml.XmlAsyncCheckReaderWithLineInfoNS..ctor(System.Xml.XmlReader) | 0 | -| System.Void System.Xml.XmlAsyncCheckReaderWithLineInfoNSSchema..ctor(System.Xml.XmlReader) | 0 | -| System.Void System.Xml.XmlAsyncCheckReaderWithNS..ctor(System.Xml.XmlReader) | 0 | -| System.Void System.Xml.XmlAsyncCheckWriter..ctor(System.Xml.XmlWriter) | 0 | -| System.Void System.Xml.XmlAutoDetectWriter..ctor(System.IO.Stream,System.Xml.XmlWriterSettings) | 0 | -| System.Void System.Xml.XmlAutoDetectWriter..ctor(System.IO.TextWriter,System.Xml.XmlWriterSettings) | 0 | -| System.Void System.Xml.XmlCharCheckingWriter..ctor(System.Xml.XmlWriter,System.Boolean,System.Boolean,System.Boolean,System.String) | 0 | -| System.Void System.Xml.XmlDOMTextWriter..ctor(System.IO.TextWriter) | 0 | -| System.Void System.Xml.XmlDocument.Load(System.IO.Stream) | 0 | -| System.Void System.Xml.XmlDocument.Load(System.IO.TextReader) | 0 | -| System.Void System.Xml.XmlDocument.Save(System.IO.TextWriter) | 0 | -| System.Void System.Xml.XmlEncodedRawTextWriter..ctor(System.IO.Stream,System.Xml.XmlWriterSettings) | 0 | -| System.Void System.Xml.XmlEncodedRawTextWriter..ctor(System.IO.TextWriter,System.Xml.XmlWriterSettings) | 0 | -| System.Void System.Xml.XmlEncodedRawTextWriterIndent..ctor(System.IO.Stream,System.Xml.XmlWriterSettings) | 0 | -| System.Void System.Xml.XmlEncodedRawTextWriterIndent..ctor(System.IO.TextWriter,System.Xml.XmlWriterSettings) | 0 | -| System.Void System.Xml.XmlEventCache.EventsToWriter(System.Xml.XmlWriter) | 0 | -| System.Void System.Xml.XmlSqlBinaryReader..ctor(System.IO.Stream,System.Byte[],System.Int32,System.String,System.Boolean,System.Xml.XmlReaderSettings) | 0 | -| System.Void System.Xml.XmlTextReader..ctor(System.IO.Stream) | 0 | -| System.Void System.Xml.XmlTextReader..ctor(System.IO.Stream,System.Xml.XmlNameTable) | 0 | -| System.Void System.Xml.XmlTextReader..ctor(System.IO.Stream,System.Xml.XmlNodeType,System.Xml.XmlParserContext) | 0 | -| System.Void System.Xml.XmlTextReader..ctor(System.IO.TextReader) | 0 | -| System.Void System.Xml.XmlTextReader..ctor(System.IO.TextReader,System.Xml.XmlNameTable) | 0 | -| System.Void System.Xml.XmlTextReader..ctor(System.String,System.IO.Stream) | 1 | -| System.Void System.Xml.XmlTextReader..ctor(System.String,System.IO.Stream,System.Xml.XmlNameTable) | 1 | -| System.Void System.Xml.XmlTextReader..ctor(System.String,System.IO.TextReader) | 1 | -| System.Void System.Xml.XmlTextReader..ctor(System.String,System.IO.TextReader,System.Xml.XmlNameTable) | 1 | -| System.Void System.Xml.XmlTextReaderImpl..ctor(System.IO.Stream) | 0 | -| System.Void System.Xml.XmlTextReaderImpl..ctor(System.IO.Stream,System.Byte[],System.Int32,System.Xml.XmlReaderSettings,System.Uri,System.String,System.Xml.XmlParserContext,System.Boolean) | 0 | -| System.Void System.Xml.XmlTextReaderImpl..ctor(System.IO.Stream,System.Xml.XmlNameTable) | 0 | -| System.Void System.Xml.XmlTextReaderImpl..ctor(System.IO.Stream,System.Xml.XmlNodeType,System.Xml.XmlParserContext) | 0 | -| System.Void System.Xml.XmlTextReaderImpl..ctor(System.IO.TextReader) | 0 | -| System.Void System.Xml.XmlTextReaderImpl..ctor(System.IO.TextReader,System.Xml.XmlNameTable) | 0 | -| System.Void System.Xml.XmlTextReaderImpl..ctor(System.IO.TextReader,System.Xml.XmlReaderSettings,System.String,System.Xml.XmlParserContext) | 0 | -| System.Void System.Xml.XmlTextReaderImpl..ctor(System.String,System.IO.Stream) | 1 | -| System.Void System.Xml.XmlTextReaderImpl..ctor(System.String,System.IO.Stream,System.Xml.XmlNameTable) | 1 | -| System.Void System.Xml.XmlTextReaderImpl..ctor(System.String,System.IO.TextReader) | 1 | -| System.Void System.Xml.XmlTextReaderImpl..ctor(System.String,System.IO.TextReader,System.Xml.XmlNameTable) | 1 | -| System.Void System.Xml.XmlTextReaderImpl.InitStreamInput(System.IO.Stream,System.Text.Encoding) | 0 | -| System.Void System.Xml.XmlTextReaderImpl.InitStreamInput(System.String,System.IO.Stream,System.Text.Encoding) | 1 | -| System.Void System.Xml.XmlTextReaderImpl.InitStreamInput(System.Uri,System.IO.Stream,System.Text.Encoding) | 1 | -| System.Void System.Xml.XmlTextReaderImpl.InitStreamInput(System.Uri,System.String,System.IO.Stream,System.Byte[],System.Int32,System.Text.Encoding) | 2 | -| System.Void System.Xml.XmlTextReaderImpl.InitStreamInput(System.Uri,System.String,System.IO.Stream,System.Text.Encoding) | 2 | -| System.Void System.Xml.XmlTextReaderImpl.InitTextReaderInput(System.String,System.IO.TextReader) | 1 | -| System.Void System.Xml.XmlTextReaderImpl.InitTextReaderInput(System.String,System.Uri,System.IO.TextReader) | 2 | -| System.Void System.Xml.XmlTextWriter..ctor(System.IO.TextWriter) | 0 | -| System.Void System.Xml.XmlUtf8RawTextWriter..ctor(System.IO.Stream,System.Xml.XmlWriterSettings) | 0 | -| System.Void System.Xml.XmlUtf8RawTextWriterIndent..ctor(System.IO.Stream,System.Xml.XmlWriterSettings) | 0 | -| System.Void System.Xml.XmlValidatingReader..ctor(System.IO.Stream,System.Xml.XmlNodeType,System.Xml.XmlParserContext) | 0 | -| System.Void System.Xml.XmlValidatingReaderImpl..ctor(System.IO.Stream,System.Xml.XmlNodeType,System.Xml.XmlParserContext) | 0 | -| System.Void System.Xml.XmlWrappingWriter..ctor(System.Xml.XmlWriter) | 0 | -| System.Void System.Xml.Xsl.Runtime.RtfTreeNavigator.CopyToWriter(System.Xml.XmlWriter) | 0 | -| System.Void System.Xml.Xsl.Runtime.XmlRawWriterWrapper..ctor(System.Xml.XmlWriter) | 0 | -| System.Void System.Xml.Xsl.XmlILCommand.Execute(System.Object,System.Xml.XmlResolver,System.Xml.Xsl.XsltArgumentList,System.Xml.XmlWriter) | 3 | -| System.Void System.Xml.Xsl.XslCompiledTransform.Transform(System.String,System.Xml.XmlWriter) | 1 | -| System.Void System.Xml.Xsl.XslCompiledTransform.Transform(System.String,System.Xml.Xsl.XsltArgumentList,System.IO.Stream) | 2 | -| System.Void System.Xml.Xsl.XslCompiledTransform.Transform(System.String,System.Xml.Xsl.XsltArgumentList,System.IO.TextWriter) | 2 | -| System.Void System.Xml.Xsl.XslCompiledTransform.Transform(System.String,System.Xml.Xsl.XsltArgumentList,System.Xml.XmlWriter) | 2 | -| System.Void System.Xml.Xsl.XslCompiledTransform.Transform(System.String,System.Xml.Xsl.XsltArgumentList,System.Xml.XmlWriter,System.Xml.XmlResolver) | 2 | -| System.Void System.Xml.Xsl.XslCompiledTransform.Transform(System.Xml.XPath.IXPathNavigable,System.Xml.XmlWriter) | 1 | -| System.Void System.Xml.Xsl.XslCompiledTransform.Transform(System.Xml.XPath.IXPathNavigable,System.Xml.Xsl.XsltArgumentList,System.IO.Stream) | 2 | -| System.Void System.Xml.Xsl.XslCompiledTransform.Transform(System.Xml.XPath.IXPathNavigable,System.Xml.Xsl.XsltArgumentList,System.IO.TextWriter) | 2 | -| System.Void System.Xml.Xsl.XslCompiledTransform.Transform(System.Xml.XPath.IXPathNavigable,System.Xml.Xsl.XsltArgumentList,System.Xml.XmlWriter) | 2 | -| System.Void System.Xml.Xsl.XslCompiledTransform.Transform(System.Xml.XPath.IXPathNavigable,System.Xml.Xsl.XsltArgumentList,System.Xml.XmlWriter,System.Xml.XmlResolver) | 2 | -| System.Void System.Xml.Xsl.XslCompiledTransform.Transform(System.Xml.XmlReader,System.Xml.XmlWriter) | 1 | -| System.Void System.Xml.Xsl.XslCompiledTransform.Transform(System.Xml.XmlReader,System.Xml.Xsl.XsltArgumentList,System.IO.Stream) | 2 | -| System.Void System.Xml.Xsl.XslCompiledTransform.Transform(System.Xml.XmlReader,System.Xml.Xsl.XsltArgumentList,System.IO.TextWriter) | 2 | -| System.Void System.Xml.Xsl.XslCompiledTransform.Transform(System.Xml.XmlReader,System.Xml.Xsl.XsltArgumentList,System.Xml.XmlWriter) | 2 | -| System.Void System.Xml.Xsl.XslCompiledTransform.Transform(System.Xml.XmlReader,System.Xml.Xsl.XsltArgumentList,System.Xml.XmlWriter,System.Xml.XmlResolver) | 2 | -| System.Xml.Schema.XmlSchema System.Xml.Schema.XmlSchema.Read(System.IO.Stream,System.Xml.Schema.ValidationEventHandler) | 0 | -| System.Xml.Schema.XmlSchema System.Xml.Schema.XmlSchema.Read(System.IO.TextReader,System.Xml.Schema.ValidationEventHandler) | 0 | -| System.Xml.XmlAsyncCheckReader System.Xml.XmlAsyncCheckReader.CreateAsyncCheckWrapper(System.Xml.XmlReader) | 0 | -| System.Xml.XmlReader System.Xml.XmlReader.Create(System.IO.Stream) | 0 | -| System.Xml.XmlReader System.Xml.XmlReader.Create(System.IO.Stream,System.Xml.XmlReaderSettings) | 0 | -| System.Xml.XmlReader System.Xml.XmlReader.Create(System.IO.Stream,System.Xml.XmlReaderSettings,System.String) | 0 | -| System.Xml.XmlReader System.Xml.XmlReader.Create(System.IO.Stream,System.Xml.XmlReaderSettings,System.Xml.XmlParserContext) | 0 | -| System.Xml.XmlReader System.Xml.XmlReader.Create(System.IO.TextReader) | 0 | -| System.Xml.XmlReader System.Xml.XmlReader.Create(System.IO.TextReader,System.Xml.XmlReaderSettings) | 0 | -| System.Xml.XmlReader System.Xml.XmlReader.Create(System.IO.TextReader,System.Xml.XmlReaderSettings,System.String) | 0 | -| System.Xml.XmlReader System.Xml.XmlReader.Create(System.IO.TextReader,System.Xml.XmlReaderSettings,System.Xml.XmlParserContext) | 0 | -| System.Xml.XmlReader System.Xml.XmlReader.CreateSqlReader(System.IO.Stream,System.Xml.XmlReaderSettings,System.Xml.XmlParserContext) | 0 | -| System.Xml.XmlReader System.Xml.XmlReaderSettings.CreateReader(System.IO.Stream,System.Uri,System.String,System.Xml.XmlParserContext) | 0 | -| System.Xml.XmlReader System.Xml.XmlReaderSettings.CreateReader(System.IO.TextReader,System.String,System.Xml.XmlParserContext) | 0 | -| System.Xml.XmlReader System.Xml.Xsl.QueryReaderSettings.CreateReader(System.IO.Stream,System.String) | 0 | -| System.Xml.XmlWriter System.Xml.XmlReader.CreateWriterForInnerOuterXml(System.IO.StringWriter) | 0 | -| System.Xml.XmlWriter System.Xml.XmlWriter.Create(System.IO.Stream) | 0 | -| System.Xml.XmlWriter System.Xml.XmlWriter.Create(System.IO.Stream,System.Xml.XmlWriterSettings) | 0 | -| System.Xml.XmlWriter System.Xml.XmlWriter.Create(System.IO.TextWriter) | 0 | -| System.Xml.XmlWriter System.Xml.XmlWriter.Create(System.IO.TextWriter,System.Xml.XmlWriterSettings) | 0 | -| System.Xml.XmlWriter System.Xml.XmlWriter.Create(System.Xml.XmlWriter) | 0 | -| System.Xml.XmlWriter System.Xml.XmlWriter.Create(System.Xml.XmlWriter,System.Xml.XmlWriterSettings) | 0 | -| System.Xml.XmlWriter System.Xml.XmlWriterSettings.AddConformanceWrapper(System.Xml.XmlWriter) | 0 | -| System.Xml.XmlWriter System.Xml.XmlWriterSettings.CreateWriter(System.IO.Stream) | 0 | -| System.Xml.XmlWriter System.Xml.XmlWriterSettings.CreateWriter(System.IO.TextWriter) | 0 | -| System.Xml.XmlWriter System.Xml.XmlWriterSettings.CreateWriter(System.Xml.XmlWriter) | 0 | -| TextEncodedRawTextWriter(Stream, XmlWriterSettings) | 0 | -| TextEncodedRawTextWriter(TextWriter, XmlWriterSettings) | 0 | -| TextUtf8RawTextWriter(Stream, XmlWriterSettings) | 0 | -| Transform(IXPathNavigable, XmlWriter) | 1 | -| Transform(IXPathNavigable, XsltArgumentList, Stream) | 2 | -| Transform(IXPathNavigable, XsltArgumentList, TextWriter) | 2 | -| Transform(IXPathNavigable, XsltArgumentList, XmlWriter) | 2 | -| Transform(IXPathNavigable, XsltArgumentList, XmlWriter, XmlResolver) | 2 | -| Transform(XmlReader, XmlWriter) | 1 | -| Transform(XmlReader, XsltArgumentList, Stream) | 2 | -| Transform(XmlReader, XsltArgumentList, TextWriter) | 2 | -| Transform(XmlReader, XsltArgumentList, XmlWriter) | 2 | -| Transform(XmlReader, XsltArgumentList, XmlWriter, XmlResolver) | 2 | -| Transform(string, XmlWriter) | 1 | -| Transform(string, XsltArgumentList, Stream) | 2 | -| Transform(string, XsltArgumentList, TextWriter) | 2 | -| Transform(string, XsltArgumentList, XmlWriter) | 2 | -| Write(TextWriter) | 0 | -| Write(TextWriter, XmlNamespaceManager) | 0 | -| XPathDocument(Stream) | 0 | -| XPathDocument(TextReader) | 0 | -| XmlAsyncCheckReader(XmlReader) | 0 | -| XmlAsyncCheckReaderWithLineInfo(XmlReader) | 0 | -| XmlAsyncCheckReaderWithLineInfoNS(XmlReader) | 0 | -| XmlAsyncCheckReaderWithLineInfoNSSchema(XmlReader) | 0 | -| XmlAsyncCheckReaderWithNS(XmlReader) | 0 | -| XmlAsyncCheckWriter(XmlWriter) | 0 | -| XmlAutoDetectWriter(Stream, XmlWriterSettings) | 0 | -| XmlAutoDetectWriter(TextWriter, XmlWriterSettings) | 0 | -| XmlDOMTextWriter(TextWriter) | 0 | -| XmlEncodedRawTextWriter(Stream, XmlWriterSettings) | 0 | -| XmlEncodedRawTextWriter(TextWriter, XmlWriterSettings) | 0 | -| XmlEncodedRawTextWriterIndent(Stream, XmlWriterSettings) | 0 | -| XmlEncodedRawTextWriterIndent(TextWriter, XmlWriterSettings) | 0 | -| XmlRawWriterWrapper(XmlWriter) | 0 | -| XmlSqlBinaryReader(Stream, byte[], int, string, bool, XmlReaderSettings) | 0 | -| XmlTextReader(Stream) | 0 | -| XmlTextReader(Stream, XmlNameTable) | 0 | -| XmlTextReader(Stream, XmlNodeType, XmlParserContext) | 0 | -| XmlTextReader(TextReader) | 0 | -| XmlTextReader(TextReader, XmlNameTable) | 0 | -| XmlTextReader(string, Stream) | 1 | -| XmlTextReader(string, Stream, XmlNameTable) | 1 | -| XmlTextReader(string, TextReader) | 1 | -| XmlTextReader(string, TextReader, XmlNameTable) | 1 | -| XmlTextWriter(TextWriter) | 0 | -| XmlUtf8RawTextWriter(Stream, XmlWriterSettings) | 0 | -| XmlUtf8RawTextWriterIndent(Stream, XmlWriterSettings) | 0 | -| XmlValidatingReader(Stream, XmlNodeType, XmlParserContext) | 0 | +| CapturesDisposable(MyType, MyType) | 0 | +| Dispose(IDisposable) | 0 | +| DisposesParameter(IDisposable, IDisposable) | 0 | +| System.Void DisposalTests.Class1.CapturesDisposable(DisposalTests.MyType,DisposalTests.MyType) | 0 | +| System.Void DisposalTests.Class1.Dispose(System.IDisposable) | 0 | +| System.Void DisposalTests.Class1.DisposesParameter(System.IDisposable,System.IDisposable) | 0 | diff --git a/csharp/ql/test/library-tests/commons/Disposal/DisposedParameter.ql b/csharp/ql/test/library-tests/commons/Disposal/DisposedParameter.ql index c9df810b2205..97ca1ba7f2c1 100644 --- a/csharp/ql/test/library-tests/commons/Disposal/DisposedParameter.ql +++ b/csharp/ql/test/library-tests/commons/Disposal/DisposedParameter.ql @@ -1,10 +1,9 @@ import dotnet import semmle.code.csharp.commons.Disposal -import Whitelist from DotNet::Callable c, DotNet::Parameter param, int p where mayBeDisposed(param) and param = c.getParameter(p) and - not whitelistedType(c.getDeclaringType()) + c.getDeclaringType().getQualifiedName() = "DisposalTests.Class1" select c.toStringWithTypes(), p diff --git a/csharp/ql/test/library-tests/commons/Disposal/UndisposedParameter.expected b/csharp/ql/test/library-tests/commons/Disposal/UndisposedParameter.expected index 469de5593975..fb648f8e6f8f 100644 --- a/csharp/ql/test/library-tests/commons/Disposal/UndisposedParameter.expected +++ b/csharp/ql/test/library-tests/commons/Disposal/UndisposedParameter.expected @@ -1,33 +1,4 @@ -| Execute(TextWriter) | 0 | -| HtmlDecode(string, TextWriter) | 1 | -| HtmlEncode(string, TextWriter) | 1 | -| IndentedTextWriter(TextWriter) | 0 | -| IndentedTextWriter(TextWriter, string) | 0 | -| Synchronized(TextWriter) | 0 | -| System.IO.TextWriter System.Console.EnsureInitialized(System.IO.TextWriter,System.Func) | 0 | -| System.IO.TextWriter System.IO.TextWriter.Synchronized(System.IO.TextWriter) | 0 | -| System.IO.TextWriter System.Threading.Volatile.Read(System.IO.TextWriter) | 0 | -| System.Tuple> System.Tuple.Create>(System.IO.TextWriter,System.ReadOnlyMemory) | 0 | -| System.Void System.CodeDom.Compiler.IndentedTextWriter..ctor(System.IO.TextWriter) | 0 | -| System.Void System.CodeDom.Compiler.IndentedTextWriter..ctor(System.IO.TextWriter,System.String) | 0 | -| System.Void System.IO.TextWriter.SyncTextWriter..ctor(System.IO.TextWriter) | 0 | -| System.Void System.Net.WebUtility.HtmlDecode(System.String,System.IO.TextWriter) | 1 | -| System.Void System.Net.WebUtility.HtmlEncode(System.String,System.IO.TextWriter) | 1 | -| System.Void System.Threading.Volatile.Write(System.IO.TextWriter,System.IO.TextWriter) | 0 | -| System.Void System.Threading.Volatile.Write(System.IO.TextWriter,System.IO.TextWriter) | 1 | -| System.Void System.Tuple..ctor(System.IO.TextWriter,System.Char) | 0 | -| System.Void System.Tuple..ctor(System.IO.TextWriter,System.Char[],System.Int32,System.Int32) | 0 | -| System.Void System.Tuple..ctor(System.IO.TextWriter,System.String) | 0 | -| System.Void System.Xml.Serialization.IndentedWriter..ctor(System.IO.TextWriter,System.Boolean) | 0 | -| System.Void System.Xml.XmlTextEncoder..ctor(System.IO.TextWriter) | 0 | -| System.Void System.Xml.Xsl.XslTransform.Transform(System.Xml.XPath.IXPathNavigable,System.Xml.Xsl.XsltArgumentList,System.IO.TextWriter) | 2 | -| System.Void System.Xml.Xsl.XslTransform.Transform(System.Xml.XPath.IXPathNavigable,System.Xml.Xsl.XsltArgumentList,System.IO.TextWriter,System.Xml.XmlResolver) | 2 | -| System.Void System.Xml.Xsl.XslTransform.Transform(System.Xml.XPath.XPathNavigator,System.Xml.Xsl.XsltArgumentList,System.IO.TextWriter) | 2 | -| System.Void System.Xml.Xsl.XslTransform.Transform(System.Xml.XPath.XPathNavigator,System.Xml.Xsl.XsltArgumentList,System.IO.TextWriter,System.Xml.XmlResolver) | 2 | -| System.Void System.Xml.Xsl.XsltOld.Processor.Execute(System.IO.TextWriter) | 0 | -| System.Void System.Xml.Xsl.XsltOld.TextOnlyOutput..ctor(System.Xml.Xsl.XsltOld.Processor,System.IO.TextWriter) | 1 | -| System.Void System.Xml.Xsl.XsltOld.TextOutput..ctor(System.Xml.Xsl.XsltOld.Processor,System.IO.TextWriter) | 1 | -| Transform(IXPathNavigable, XsltArgumentList, TextWriter) | 2 | -| Transform(IXPathNavigable, XsltArgumentList, TextWriter, XmlResolver) | 2 | -| Transform(XPathNavigator, XsltArgumentList, TextWriter) | 2 | -| Transform(XPathNavigator, XsltArgumentList, TextWriter, XmlResolver) | 2 | +| CapturesDisposable(MyType, MyType) | 1 | +| DisposesParameter(IDisposable, IDisposable) | 1 | +| System.Void DisposalTests.Class1.CapturesDisposable(DisposalTests.MyType,DisposalTests.MyType) | 1 | +| System.Void DisposalTests.Class1.DisposesParameter(System.IDisposable,System.IDisposable) | 1 | diff --git a/csharp/ql/test/library-tests/commons/Disposal/UndisposedParameter.ql b/csharp/ql/test/library-tests/commons/Disposal/UndisposedParameter.ql index ef9933fc4c43..9125fcd3d284 100644 --- a/csharp/ql/test/library-tests/commons/Disposal/UndisposedParameter.ql +++ b/csharp/ql/test/library-tests/commons/Disposal/UndisposedParameter.ql @@ -5,6 +5,6 @@ import cil from DotNet::Callable c, DotNet::Parameter param, int p where not mayBeDisposed(param) and - param.getType().hasName("TextWriter") and - param = c.getParameter(p) + param = c.getParameter(p) and + c.getDeclaringType().getQualifiedName() = "DisposalTests.Class1" select c.toStringWithTypes(), p diff --git a/csharp/ql/test/library-tests/commons/Disposal/Whitelist.qll b/csharp/ql/test/library-tests/commons/Disposal/Whitelist.qll deleted file mode 100644 index 4fd1f8eaf9e0..000000000000 --- a/csharp/ql/test/library-tests/commons/Disposal/Whitelist.qll +++ /dev/null @@ -1,18 +0,0 @@ -/** Provides a simple whitelist for ignoring results. */ - -import dotnet - -/** Holds if `type` is platform-specific. */ -predicate whitelistedType(DotNet::Type type) { - exists(string qn | qn = type.getQualifiedName() | - qn = "System.Net.Http.WinHttpHandler" or - qn.matches("Microsoft.Win32%") or - qn = "System.ConsolePal.UnixConsoleStream" or - qn = "System.Globalization.CompareInfo" or - qn = "System.IO.FileSystemEnumerableIterator" or - qn.matches("System.IO.FileStream%") or - qn.matches("System.Net.Http.CurlHandler%") or - qn = "System.Net.Http.HttpClientHandler" or - qn.matches("System.Net.Http.WinHttp%") - ) -} diff --git a/csharp/ql/test/query-tests/Security Features/CWE-079/StoredXSS/AspInline.ql b/csharp/ql/test/query-tests/Security Features/CWE-079/StoredXSS/AspInline.ql index 48b40897f2a0..f28295c8f5e1 100644 --- a/csharp/ql/test/query-tests/Security Features/CWE-079/StoredXSS/AspInline.ql +++ b/csharp/ql/test/query-tests/Security Features/CWE-079/StoredXSS/AspInline.ql @@ -1,10 +1,10 @@ import csharp import semmle.code.csharp.security.dataflow.XSS -string tweakMemberLocation(XSS::AspInlineMember inline, Member member) { +string tweakMemberLocation(Member member) { exists(Location loc | loc = member.getLocation() and - if loc.getFile().getParentContainer() = inline.getLocation().getFile().getParentContainer() + if loc instanceof SourceLocation then result = loc.toString() else result = "" ) @@ -14,4 +14,4 @@ from XSS::AspInlineMember inline, Member member where member = inline.getMember() // some members, such as ASP members inherited from DLLs, are outside the test directory, // so we select them specially using a modified location and the normal toString -select inline, tweakMemberLocation(inline, member), member.toString() +select inline, tweakMemberLocation(member), member.toString()