@@ -23,6 +23,7 @@ private import semmle.code.csharp.dataflow.internal.DelegateDataFlow
2323private import semmle.code.csharp.frameworks.EntityFramework
2424private import semmle.code.csharp.frameworks.JsonNET
2525private import FlowSummary
26+ private import semmle.code.csharp.dataflow.ExternalFlow
2627
2728private newtype TAccessPath =
2829 TNilAccessPath ( ) or
@@ -500,29 +501,17 @@ private module FrameworkDataFlowAdaptor {
500501}
501502
502503/** 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+ ]
526515 }
527516}
528517
0 commit comments