mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
C#: Convert System.IO.Stream flow to CSV format.
This commit is contained in:
@@ -1779,32 +1779,6 @@ library class SystemTextEncodingFlow extends LibraryTypeDataFlow, SystemTextEnco
|
||||
}
|
||||
}
|
||||
|
||||
/** Data flow for `System.IO.Stream`. */
|
||||
class SystemIOStreamFlow extends LibraryTypeDataFlow, SystemIOStreamClass {
|
||||
override predicate callableFlow(
|
||||
CallableFlowSource source, CallableFlowSink sink, SourceDeclarationCallable c,
|
||||
boolean preservesValue
|
||||
) {
|
||||
(
|
||||
c = this.getAReadMethod().getAnOverrider*() and
|
||||
c.getParameter(0).getType().(ArrayType).getElementType() instanceof ByteType and
|
||||
sink = TCallableFlowSinkArg(0) and
|
||||
source = TCallableFlowSourceQualifier()
|
||||
or
|
||||
c = this.getAWriteMethod().getAnOverrider*() and
|
||||
c.getParameter(0).getType().(ArrayType).getElementType() instanceof ByteType and
|
||||
source = TCallableFlowSourceArg(0) and
|
||||
sink = TCallableFlowSinkQualifier()
|
||||
or
|
||||
c = any(Method m | m = this.getAMethod() and m.getName().matches("CopyTo%")).getAnOverrider*() and
|
||||
c.getParameter(0).getType() instanceof SystemIOStreamClass and
|
||||
source = TCallableFlowSourceQualifier() and
|
||||
sink = TCallableFlowSinkArg(0)
|
||||
) and
|
||||
preservesValue = false
|
||||
}
|
||||
}
|
||||
|
||||
/** Data flow for `System.IO.Compression.DeflateStream`. */
|
||||
class SystemIOCompressionDeflateStreamFlow extends LibraryTypeDataFlow,
|
||||
SystemIOCompressionDeflateStream {
|
||||
|
||||
@@ -112,6 +112,29 @@ class SystemIOStreamClass extends SystemIOClass {
|
||||
}
|
||||
}
|
||||
|
||||
/** Data flow for `System.IO.Stream`. */
|
||||
private class SystemIOStreamFlowModelCsv extends SummaryModelCsv {
|
||||
override predicate row(string row) {
|
||||
row =
|
||||
[
|
||||
"System.IO;Stream;false;CopyTo;(System.IO.Stream);;Argument[-1];Argument[0];taint",
|
||||
"System.IO;Stream;false;CopyToAsync;(System.IO.Stream);;Argument[-1];Argument[0];taint",
|
||||
"System.IO;Stream;false;CopyToAsync;(System.IO.Stream,System.Int32);;Argument[-1];Argument[0];taint",
|
||||
"System.IO;Stream;false;CopyToAsync;(System.IO.Stream,System.Threading.CancellationToken);;Argument[-1];Argument[0];taint",
|
||||
"System.IO;Stream;false;ReadAsync;(System.Byte[],System.Int32,System.Int32);;Argument[-1];Argument[0];taint",
|
||||
"System.IO;Stream;false;WriteAsync;(System.Byte[],System.Int32,System.Int32);;Argument[0];Argument[-1];taint",
|
||||
"System.IO;Stream;true;BeginRead;(System.Byte[],System.Int32,System.Int32,System.AsyncCallback,System.Object);;Argument[-1];Argument[0];taint",
|
||||
"System.IO;Stream;true;BeginWrite;(System.Byte[],System.Int32,System.Int32,System.AsyncCallback,System.Object);;Argument[0];Argument[-1];taint",
|
||||
"System.IO;Stream;true;CopyTo;(System.IO.Stream,System.Int32);;Argument[-1];Argument[0];taint",
|
||||
"System.IO;Stream;true;CopyToAsync;(System.IO.Stream,System.Int32,System.Threading.CancellationToken);;Argument[-1];Argument[0];taint",
|
||||
"System.IO;Stream;true;Read;(System.Byte[],System.Int32,System.Int32);;Argument[-1];Argument[0];taint",
|
||||
"System.IO;Stream;true;ReadAsync;(System.Byte[],System.Int32,System.Int32,System.Threading.CancellationToken);;Argument[-1];Argument[0];taint",
|
||||
"System.IO;Stream;true;Write;(System.Byte[],System.Int32,System.Int32);;Argument[0];Argument[-1];taint",
|
||||
"System.IO;Stream;true;WriteAsync;(System.Byte[],System.Int32,System.Int32,System.Threading.CancellationToken);;Argument[0];Argument[-1];taint"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
/** The `System.IO.MemoryStream` class. */
|
||||
class SystemIOMemoryStreamClass extends SystemIOClass {
|
||||
SystemIOMemoryStreamClass() { this.hasName("MemoryStream") }
|
||||
|
||||
Reference in New Issue
Block a user