C#: Convert System.Boolean flow to CSV format.

This commit is contained in:
Michael Nebel
2021-12-02 10:33:47 +01:00
parent 520f598d49
commit 8eb041c172
2 changed files with 12 additions and 31 deletions

View File

@@ -499,37 +499,6 @@ private module FrameworkDataFlowAdaptor {
}
}
/** Data flow for `System.Boolean`. */
class SystemBooleanFlow extends LibraryTypeDataFlow, SystemBooleanStruct {
override predicate callableFlow(
CallableFlowSource source, CallableFlowSink sink, SourceDeclarationCallable c,
boolean preservesValue
) {
this.methodFlow(source, sink, c) and
preservesValue = false
}
private predicate methodFlow(
CallableFlowSource source, CallableFlowSink sink, SourceDeclarationMethod m
) {
m = this.getParseMethod() and
(
source = TCallableFlowSourceArg(0) and
sink = TCallableFlowSinkReturn()
)
or
m = this.getTryParseMethod() and
(
source = TCallableFlowSourceArg(0) and
(
sink = TCallableFlowSinkReturn()
or
sink = TCallableFlowSinkArg(any(int i | m.getParameter(i).isOutOrRef()))
)
)
}
}
/** Data flow for `System.Uri`. */
class SystemUriFlow extends LibraryTypeDataFlow, SystemUriClass {
override predicate callableFlow(

View File

@@ -92,6 +92,18 @@ class SystemBooleanStruct extends BoolType {
}
}
/** Data flow for `System.Boolean` */
private class SystemBoolean32FlowModelCsv extends SummaryModelCsv {
override predicate row(string row) {
row =
[
"System;Boolean;false;Parse;(System.String);;Argument[0];ReturnValue;taint",
"System;Boolean;false;TryParse;(System.String,System.Boolean);;Argument[0];Argument[1];taint",
"System;Boolean;false;TryParse;(System.String,System.Boolean);;Argument[0];ReturnValue;taint"
]
}
}
/** The `System.Convert` class. */
class SystemConvertClass extends SystemClass {
SystemConvertClass() { this.hasName("Convert") }