@@ -23,6 +23,7 @@ private import semmle.code.csharp.dataflow.internal.DelegateDataFlow
23
23
private import semmle.code.csharp.frameworks.EntityFramework
24
24
private import semmle.code.csharp.frameworks.JsonNET
25
25
private import FlowSummary
26
+ private import semmle.code.csharp.dataflow.ExternalFlow
26
27
27
28
private newtype TAccessPath =
28
29
TNilAccessPath ( ) or
@@ -500,29 +501,17 @@ private module FrameworkDataFlowAdaptor {
500
501
}
501
502
502
503
/** Data flow for `System.Int32`. */
503
- class SystemInt32Flow extends LibraryTypeDataFlow , SystemInt32Struct {
504
- override predicate callableFlow (
505
- CallableFlowSource source , CallableFlowSink sink , SourceDeclarationCallable c ,
506
- boolean preservesValue
507
- ) {
508
- methodFlow ( source , sink , c ) and
509
- preservesValue = false
510
- }
511
-
512
- private predicate methodFlow (
513
- CallableFlowSource source , CallableFlowSink sink , SourceDeclarationMethod m
514
- ) {
515
- m = getParseMethod ( ) and
516
- source = TCallableFlowSourceArg ( 0 ) and
517
- sink = TCallableFlowSinkReturn ( )
518
- or
519
- m = getTryParseMethod ( ) and
520
- source = TCallableFlowSourceArg ( 0 ) and
521
- (
522
- sink = TCallableFlowSinkReturn ( )
523
- or
524
- sink = TCallableFlowSinkArg ( any ( int i | m .getParameter ( i ) .isOutOrRef ( ) ) )
525
- )
504
+ private class SystemInt32FlowModelCsv extends SummaryModelCsv {
505
+ override predicate row ( string row ) {
506
+ row =
507
+ [
508
+ "System;Int32;false;Parse;;;Argument[0];ReturnValue;taint" ,
509
+ "System;Int32;false;TryParse;;;Argument[0];ReturnValue;taint" ,
510
+ "System;Int32;false;TryParse;(System.String,System.Int32);;Argument[0];Argument[1];taint" ,
511
+ "System;Int32;false;TryParse;(System.ReadOnlySpan<System.Char>,System.Int32);;Argument[0];Argument[1];taint" ,
512
+ "System;Int32;false;TryParse;(System.String,System.Globalization.NumberStyles,System.IFormatProvider,System.Int32);;Argument[0];Argument[3];taint" ,
513
+ "System;Int32;false;TryParse;(System.ReadOnlySpan<System.Char>,System.Globalization.NumberStyles,System.IFormatProvider,System.Int32);;Argument[0];Argument[3];taint"
514
+ ]
526
515
}
527
516
}
528
517
0 commit comments