Skip to content

Commit ca5c692

Browse files
committed
C#: Convert System.IO.Compression flow to CSV format.
1 parent 45e416b commit ca5c692

File tree

3 files changed

+15
-18
lines changed

3 files changed

+15
-18
lines changed

csharp/ql/lib/semmle/code/csharp/dataflow/ExternalFlow.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ private module Frameworks {
9999
private import semmle.code.csharp.frameworks.system.web.ui.WebControls
100100
private import semmle.code.csharp.frameworks.JsonNET
101101
private import semmle.code.csharp.frameworks.system.IO
102+
private import semmle.code.csharp.frameworks.system.io.Compression
102103
}
103104

104105
/**

csharp/ql/lib/semmle/code/csharp/dataflow/LibraryTypeDataFlow.qll

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,24 +1779,6 @@ library class SystemTextEncodingFlow extends LibraryTypeDataFlow, SystemTextEnco
17791779
}
17801780
}
17811781

1782-
/** Data flow for `System.IO.Compression.DeflateStream`. */
1783-
class SystemIOCompressionDeflateStreamFlow extends LibraryTypeDataFlow,
1784-
SystemIOCompressionDeflateStream {
1785-
override predicate callableFlow(
1786-
CallableFlowSource source, CallableFlowSink sink, SourceDeclarationCallable c,
1787-
boolean preservesValue
1788-
) {
1789-
this.constructorFlow(source, sink, c) and
1790-
preservesValue = false
1791-
}
1792-
1793-
private predicate constructorFlow(CallableFlowSource source, CallableFlowSink sink, Constructor c) {
1794-
c = this.getAMember() and
1795-
source = TCallableFlowSourceArg(0) and
1796-
sink = TCallableFlowSinkReturn()
1797-
}
1798-
}
1799-
18001782
/** Data flow for `System.Xml.XmlReader`. */
18011783
class SystemXmlXmlReaderFlow extends LibraryTypeDataFlow, SystemXmlXmlReaderClass {
18021784
override predicate callableFlow(

csharp/ql/lib/semmle/code/csharp/frameworks/system/io/Compression.qll

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import csharp
44
private import semmle.code.csharp.frameworks.system.IO
5+
private import semmle.code.csharp.dataflow.ExternalFlow
56

67
/** The `System.IO.Compression` namespace. */
78
class SystemIOCompressionNamespace extends Namespace {
@@ -20,3 +21,16 @@ class SystemIOCompressionClass extends Class {
2021
class SystemIOCompressionDeflateStream extends SystemIOCompressionClass {
2122
SystemIOCompressionDeflateStream() { this.hasName("DeflateStream") }
2223
}
24+
25+
/** Data flow for `System.IO.Compression.DeflateStream`. */
26+
private class SystemIOCompressionDeflateStreamFlowModelCsv extends SummaryModelCsv {
27+
override predicate row(string row) {
28+
row =
29+
[
30+
"System.IO.Compression;DeflateStream;false;DeflateStream;(System.IO.Stream,System.IO.Compression.CompressionLevel);;Argument[0];ReturnValue;taint",
31+
"System.IO.Compression;DeflateStream;false;DeflateStream;(System.IO.Stream,System.IO.Compression.CompressionLevel,System.Boolean);;Argument[0];ReturnValue;taint",
32+
"System.IO.Compression;DeflateStream;false;DeflateStream;(System.IO.Stream,System.IO.Compression.CompressionMode);;Argument[0];ReturnValue;taint",
33+
"System.IO.Compression;DeflateStream;false;DeflateStream;(System.IO.Stream,System.IO.Compression.CompressionMode,System.Boolean);;Argument[0];ReturnValue;taint"
34+
]
35+
}
36+
}

0 commit comments

Comments
 (0)