Skip to content

Commit 8eb041c

Browse files
committed
C#: Convert System.Boolean flow to CSV format.
1 parent 520f598 commit 8eb041c

File tree

2 files changed

+12
-31
lines changed

2 files changed

+12
-31
lines changed

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

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -499,37 +499,6 @@ private module FrameworkDataFlowAdaptor {
499499
}
500500
}
501501

502-
/** Data flow for `System.Boolean`. */
503-
class SystemBooleanFlow extends LibraryTypeDataFlow, SystemBooleanStruct {
504-
override predicate callableFlow(
505-
CallableFlowSource source, CallableFlowSink sink, SourceDeclarationCallable c,
506-
boolean preservesValue
507-
) {
508-
this.methodFlow(source, sink, c) and
509-
preservesValue = false
510-
}
511-
512-
private predicate methodFlow(
513-
CallableFlowSource source, CallableFlowSink sink, SourceDeclarationMethod m
514-
) {
515-
m = this.getParseMethod() and
516-
(
517-
source = TCallableFlowSourceArg(0) and
518-
sink = TCallableFlowSinkReturn()
519-
)
520-
or
521-
m = this.getTryParseMethod() and
522-
(
523-
source = TCallableFlowSourceArg(0) and
524-
(
525-
sink = TCallableFlowSinkReturn()
526-
or
527-
sink = TCallableFlowSinkArg(any(int i | m.getParameter(i).isOutOrRef()))
528-
)
529-
)
530-
}
531-
}
532-
533502
/** Data flow for `System.Uri`. */
534503
class SystemUriFlow extends LibraryTypeDataFlow, SystemUriClass {
535504
override predicate callableFlow(

csharp/ql/lib/semmle/code/csharp/frameworks/System.qll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,18 @@ class SystemBooleanStruct extends BoolType {
9292
}
9393
}
9494

95+
/** Data flow for `System.Boolean` */
96+
private class SystemBoolean32FlowModelCsv extends SummaryModelCsv {
97+
override predicate row(string row) {
98+
row =
99+
[
100+
"System;Boolean;false;Parse;(System.String);;Argument[0];ReturnValue;taint",
101+
"System;Boolean;false;TryParse;(System.String,System.Boolean);;Argument[0];Argument[1];taint",
102+
"System;Boolean;false;TryParse;(System.String,System.Boolean);;Argument[0];ReturnValue;taint"
103+
]
104+
}
105+
}
106+
95107
/** The `System.Convert` class. */
96108
class SystemConvertClass extends SystemClass {
97109
SystemConvertClass() { this.hasName("Convert") }

0 commit comments

Comments
 (0)